summaryrefslogtreecommitdiff
path: root/src/lib/elm_image.eo
blob: b458872029c3576a1e4be1fe9d5d34436111a656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
import evas_image;

enum Elm.Image_Orient
{
   [[
     Using Evas_Image_Orient enums.
     @since 1.14
   ]]
   legacy: elm_image;
   orient_none     =  Evas.Image_Orient.orient_none,
   orient_0        =  Evas.Image_Orient.orient_0,
   rotate_90       =  Evas.Image_Orient.orient_90,
   orient_90       =  Evas.Image_Orient.orient_90,
   rotate_180      =  Evas.Image_Orient.orient_180,
   orient_180      =  Evas.Image_Orient.orient_180,
   rotate_270      =  Evas.Image_Orient.orient_270,
   orient_270      =  Evas.Image_Orient.orient_270,
   flip_horizontal =  Evas.Image_Orient.flip_horizontal,
   flip_vertical   =  Evas.Image_Orient.flip_vertical,
   flip_transpose  =  Evas.Image_Orient.flip_transpose,
   flip_transverse =  Evas.Image_Orient.flip_transverse
}

struct Elm.Image_Progress
{
   [[
     Structure associated with smart callback 'download,progress'.
     @since 1.8
   ]]
   now:   double;
   total: double;
}

struct Elm.Image.Error
{
   [[
     Structure associated with smart callback 'download,progress'.
     @since 1.8
   ]]
   status:     int;
   open_error: Eina.Bool;
}

class Elm.Image (Elm.Widget, Efl.File, Efl.Image, Evas.Clickable_Interface,
                 Edje.Object,
                 Elm.Interface_Atspi_Image, Elm.Interface_Atspi_Widget_Action,
                 Efl.Player)
{
   eo_prefix: elm_obj_image;
   methods {
      @property editable {
         [[Contrtol if thhe image is 'editable'.

           This means the image is a valid drag target for drag and drop, and can be
           cut or pasted too.]]
         set {
         }
         get {
         }
         values {
            set: bool; [[Turn on or off editability. Default is $false.]]
         }
      }
      @property resize_down {
         [[Control whether the object's image can be resized to a size smaller than the original one.

           @since 1.7]]
         set {
            legacy: null;
         }
         get {
            legacy: null;
         }
         values {
            resize_down: bool; [[whether resizing down is allowed]]
         }
      }
      @property resize_up {
         [[Control whether the object's image can be resized to a size larget than the original one.

           @since 1.7]]
         set {
            legacy: null;
         }
         get {
            legacy: null;
         }
         values {
            resize_up: bool; [[whether resizing up is allowed]]
         }
      }
      @property smooth {
         [[Control the smooth effect for an image.

           Set the scaling algorithm to be used when scaling the image. Smooth
           scaling provides a better resulting image, but is slower.

           The smooth scaling should be disabled when making animations that change
           the image size, since it will be faster. Animations that don't require
           resizing of the image can keep the smooth scaling enabled (even if the
           image is already scaled, since the scaled image will be cached).]]
         set {
         }
         get {
         }
         values {
            smooth: bool; [[$true if smooth scaling should be used, $false otherwise. Default is $true.]]
         }
      }
      @property no_scale {
         [[Control scaling behaviour of this object.

           This function disables scaling of the elm_image widget through the
           function elm_object_scale_set(). However, this does not affect the widget
           size/resize in any way. For that effect, take a look at
           @.resizable and @Elm.Widget.scale]]
         set {
         }
         get {
         }
         values {
            no_scale: bool; [[$true if the object is not scalable, $false otherwise. Default is $false.]]
         }
      }
      @property scale {
         [[Control the scale of the object's image.

           @since 1.7]]
         set {
            legacy: null;
         }
         get {
            legacy: null;
         }
         values {
            scale: double; [[Object's image scale.]]
         }
      }
      @property fill_inside {
         [[Control the resize method for the object's internal image when maintaining a given aspect ratio.

           If $fill_inside is true, image does not overflow the widget and
           blank spaces are added to fill the space that is still free. If it
           is false, the image overflows the image will fill all space and
           overflow in its larger dimension.

           You can think of it as "fill: inside" or "fill: outside" and not as
           "fill the inside".

           @since 1.7]]
         set {
            legacy: null;
         }
         get {
            legacy: null;
         }
         values {
            fill_inside: bool; [[Resize method for the object's internal image.]]
         }
      }
      @property aspect_fixed {
         set {
            [[Control whether the original aspect ratio of the image should be kept on resize.

              The original aspect ratio (width / height) of the image is usually
              distorted to match the object's size. Enabling this option will retain
              this original aspect, and the way that the image is fit into the object's
              area depends on the option set by @.fill_outside.]]
         }
         get {
         }
         values {
            fixed: bool; [[$true if the image should retain the aspect, $false otherwise.]]
         }
      }
      @property orient {
         [[Contrtol the image orientation.

           This function allows to rotate or flip the given image.]]
         set {
         }
         get {
         }
         values {
            orient: Elm.Image_Orient; [[The image orientation Elm.Image.Orient Default is #ELM_IMAGE_ORIENT_NONE.]]
         }
      }
      @property fill_outside {
         [[Control if the image fills the entire object area, when keeping the aspect ratio.

           When the image should keep its aspect ratio even if resized to another
           aspect ratio, there are two possibilities to resize it: keep the entire
           image inside the limits of height and width of the object ($fill_outside
           is $false) or let the extra width or height go outside of the object,
           and the image will fill the entire object ($fill_outside is $true).

           Note: This option will have no effect if @.aspect_fixed
           is set to $false.

           See also @.fill_inside.]]
         set {
         }
         get {
         }
         values {
            fill_outside: bool; [[$true if the object is filled outside, $false otherwise. Default is $false.]]
         }
      }
      @property resizable {
         [[Control if the object is (up/down) resizable.

           This function limits the image resize ability. If $size_up is set to
           $false, the object can't have its height or width resized to a value
           higher than the original image size. Same is valid for $size_down.]]
         set {
         }
         get {
         }
         values {
            up: bool; [[A bool to set if the object is resizable up. Default is $true.]]
            down: bool; [[A bool to set if the object is resizable down. Default is $true.]]
         }
      }
      @property preload_disabled {
         set {
            [[Enable or disable preloading of the image]]
         }
         values {
            disabled: bool; [[If true, preloading will be disabled]]
         }
      }
      @property mmap {
         set {
            [[Set the file that will be used as the image's source.

              See: elm_image_file_set()

              Note: This function will trigger the Edje file case based on the
              extension of the $file string use to create the Eina_File (expects
              $".edj", for this case).

              Note: If you use animated gif image and create multiple image objects with
              one gif image file, you should set the $group differently for each object.
              Or image objects will share one evas image cache entry and you will get
              unwanted frames.]]

            return: bool; [[$true = success, $false = error]]
            legacy: null;
         }
         values {
            file: const(Eina.File)*; [[The handler to an Eina_File that will be used as image source]]
            group: const(char)* @optional; [[The group that the image belongs to, in case it's an EET (including Edje case) file. This can be used as a key inside evas image cache if this is a normal image file not eet file.]]
         }
      }
      @property memfile {
         set {
            [[Set a location in memory to be used as an image object's source bitmap.

              This function is handy when the contents of an image file are
              mapped in memory, for example.

              The $format string should be something like $"png", $"jpg",
              $"tga", $"tiff", $"bmp" etc, when provided ($NULL, on the
              contrary). This improves the loader performance as it tries the
              "correct" loader first, before trying a range of other possible
              loaders until one succeeds.

              @since 1.7]]

            return: bool; [[$true = success, $false = error]]
         }
         values {
            img: const(void)*; [[The binary data that will be used as image source]]
            size: size; [[The size of binary data blob $img]]
            format: const(char)* @optional; [[(Optional) expected format of $img bytes]]
            key: const(char)* @optional; [[Optional indexing key of $img to be passed to the image loader (eg. if $img is a memory-mapped EET file)]]
         }
      }
      @property object {
         get {
            [[Get the inlined image object of the image widget.

              This function allows one to get the underlying $Evas_Object of type
              Image from this elementary widget. It can be useful to do things like get
              the pixel data, save the image to a file, etc.

              Note: Be careful to not manipulate it, as it is under control of
              elementary.]]

            return: Evas.Object *; [[The inlined image object, or NULL if none exists]]
         }
      }
      @property object_size {
         get {
            [[Get the current size of the image.

              This is the real size of the image, not the size of the object.]]
         }
         values {
            w: int; [[Pointer to store width, or NULL.]]
            h: int; [[Pointer to store height, or NULL.]]
         }
      }
      sizing_eval {
         [[Re-evaluate the object's final geometry.

           @since 1.7]]
         legacy: null;
      }
   }
   implements {
      class.constructor;
      Eo.Base.constructor;
      Efl.File.file.set;
      Efl.File.file.get;
      Efl.File.mmap.set;
      Efl.File.async.set;
      Efl.File.async.get;
      Efl.File.async_wait;
      Efl.Image.load_size.set;
      Efl.Image.load_size.get;
      Efl.Image.smooth_scale.set;
      Efl.Image.smooth_scale.get;
      Efl.Player.playable.get;
      Efl.Player.play.set;
      Efl.Player.play.get;
      Edje.Object.signal_emit;
      Edje.Object.size_min.get;
      Edje.Object.size_max.get;
      Edje.Object.size_min_calc;
      Edje.Object.calc_force;
      Evas.Object_Smart.hide;
      Evas.Object_Smart.clip.set;
      Evas.Object_Smart.clip_unset;
      Evas.Object_Smart.show;
      Evas.Object_Smart.color.set;
      Evas.Object_Smart.move;
      Evas.Object_Smart.add;
      Evas.Object_Smart.del;
      Evas.Object_Smart.member_add;
      Evas.Object_Smart.resize;
      Elm.Widget.theme_apply;
      Elm.Widget.event;
      Elm.Interface_Atspi_Image.extents.get;
      Elm.Interface_Atspi_Widget_Action.elm_actions.get;
   }
   events {
      drop;
      download,start;
      download,progress;
      download,done;
      download,error;
   }

}