diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-23 13:05:20 +0200 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-23 14:17:38 +0200 |
commit | 745132692b1809ef606ae69e4801280e83303589 (patch) | |
tree | 587bf1ae728e4eb049976b4a34e7e8740b435a7c /src/lib/elm_image.eo | |
parent | 02e929e6373b58b0d151d8f70dfb8ee11d755705 (diff) |
Eolian: Integration of Image
Diffstat (limited to 'src/lib/elm_image.eo')
-rw-r--r-- | src/lib/elm_image.eo | 547 |
1 files changed, 547 insertions, 0 deletions
diff --git a/src/lib/elm_image.eo b/src/lib/elm_image.eo new file mode 100644 index 000000000..41913873b --- /dev/null +++ b/src/lib/elm_image.eo | |||
@@ -0,0 +1,547 @@ | |||
1 | class Elm_Image (Elm_Widget, Evas_Clickable_Interface) | ||
2 | { | ||
3 | eo_prefix: elm_obj_image; | ||
4 | properties { | ||
5 | editable { | ||
6 | set { | ||
7 | /*@ | ||
8 | Make the image 'editable'. | ||
9 | |||
10 | This means the image is a valid drag target for drag and drop, and can be | ||
11 | cut or pasted too. | ||
12 | |||
13 | @ingroup Image */ | ||
14 | } | ||
15 | get { | ||
16 | /*@ | ||
17 | Check if the image is 'editable'. | ||
18 | |||
19 | @return Editability. | ||
20 | |||
21 | A return value of EINA_TRUE means the image is a valid drag target | ||
22 | for drag and drop, and can be cut or pasted too. | ||
23 | |||
24 | @ingroup Image */ | ||
25 | } | ||
26 | values { | ||
27 | Eina_Bool set; /*@ Turn on or off editability. Default is @c EINA_FALSE. */ | ||
28 | } | ||
29 | } | ||
30 | smooth_scale { | ||
31 | set { | ||
32 | /*@ No description supplied by the EAPI. */ | ||
33 | } | ||
34 | get { | ||
35 | /*@ No description supplied by the EAPI. */ | ||
36 | } | ||
37 | values { | ||
38 | Eina_Bool smooth; | ||
39 | } | ||
40 | } | ||
41 | resize_down { | ||
42 | set { | ||
43 | /*@ No description supplied by the EAPI. */ | ||
44 | } | ||
45 | get { | ||
46 | /*@ No description supplied by the EAPI. */ | ||
47 | } | ||
48 | values { | ||
49 | Eina_Bool resize_down; | ||
50 | } | ||
51 | } | ||
52 | load_size { | ||
53 | set { | ||
54 | /*@ No description supplied by the EAPI. */ | ||
55 | } | ||
56 | get { | ||
57 | /*@ No description supplied by the EAPI. */ | ||
58 | } | ||
59 | values { | ||
60 | int size; | ||
61 | } | ||
62 | } | ||
63 | animated_play { | ||
64 | set { | ||
65 | /*@ | ||
66 | Start or stop an image object's animation. | ||
67 | |||
68 | To actually start playing any image object's animation, if it | ||
69 | supports it, one must do something like: | ||
70 | |||
71 | @code | ||
72 | if (elm_image_animated_available_get(img)) | ||
73 | { | ||
74 | elm_image_animated_set(img, EINA_TRUE); | ||
75 | elm_image_animated_play_set(img, EINA_TRUE); | ||
76 | } | ||
77 | @endcode | ||
78 | |||
79 | elm_image_animated_set() will enable animation on the image, <b>but | ||
80 | not start it yet</b>. This is the function one uses to start and | ||
81 | stop animations on image objects. | ||
82 | |||
83 | @see elm_image_animated_available_get() | ||
84 | @see elm_image_animated_set() | ||
85 | @see elm_image_animated_play_get() | ||
86 | |||
87 | @ingroup Image | ||
88 | @since 1.7 */ | ||
89 | } | ||
90 | get { | ||
91 | /*@ | ||
92 | Get whether an image object is under animation or not. | ||
93 | |||
94 | @return @c EINA_TRUE, if the image is being animated, @c EINA_FALSE | ||
95 | otherwise. | ||
96 | |||
97 | @see elm_image_animated_play_get() | ||
98 | |||
99 | @ingroup Image | ||
100 | @since 1.7 */ | ||
101 | } | ||
102 | values { | ||
103 | Eina_Bool play; /*@ @c EINA_TRUE to start the animation, @c EINA_FALSE | ||
104 | otherwise. Default is @c EINA_FALSE. */ | ||
105 | } | ||
106 | } | ||
107 | resize_up { | ||
108 | set { | ||
109 | /*@ No description supplied by the EAPI. */ | ||
110 | } | ||
111 | get { | ||
112 | /*@ No description supplied by the EAPI. */ | ||
113 | } | ||
114 | values { | ||
115 | Eina_Bool resize_up; | ||
116 | } | ||
117 | } | ||
118 | smooth { | ||
119 | set { | ||
120 | /*@ | ||
121 | Set the smooth effect for an image. | ||
122 | |||
123 | Set the scaling algorithm to be used when scaling the image. Smooth | ||
124 | scaling provides a better resulting image, but is slower. | ||
125 | |||
126 | The smooth scaling should be disabled when making animations that change | ||
127 | the image size, since it will be faster. Animations that don't require | ||
128 | resizing of the image can keep the smooth scaling enabled (even if the | ||
129 | image is already scaled, since the scaled image will be cached). | ||
130 | |||
131 | @see elm_image_smooth_get() | ||
132 | |||
133 | @ingroup Image */ | ||
134 | } | ||
135 | get { | ||
136 | /*@ | ||
137 | Get the smooth effect for an image. | ||
138 | |||
139 | @return @c EINA_TRUE if smooth scaling is enabled, @c EINA_FALSE otherwise. | ||
140 | |||
141 | @see elm_image_smooth_set() | ||
142 | |||
143 | @ingroup Image */ | ||
144 | } | ||
145 | values { | ||
146 | Eina_Bool smooth; /*@ @c EINA_TRUE if smooth scaling should be used, @c EINA_FALSE | ||
147 | otherwise. Default is @c EINA_TRUE. */ | ||
148 | } | ||
149 | } | ||
150 | no_scale { | ||
151 | set { | ||
152 | /*@ | ||
153 | Disable scaling of this object. | ||
154 | |||
155 | This function disables scaling of the elm_image widget through the | ||
156 | function elm_object_scale_set(). However, this does not affect the widget | ||
157 | size/resize in any way. For that effect, take a look at | ||
158 | elm_image_resizable_set(). | ||
159 | |||
160 | @see elm_image_no_scale_get() | ||
161 | @see elm_image_resizable_set() | ||
162 | @see elm_object_scale_set() | ||
163 | |||
164 | @ingroup Image */ | ||
165 | } | ||
166 | get { | ||
167 | /*@ | ||
168 | Get whether scaling is disabled on the object. | ||
169 | |||
170 | @return @c EINA_TRUE if scaling is disabled, @c EINA_FALSE otherwise | ||
171 | |||
172 | @see elm_image_no_scale_set() | ||
173 | |||
174 | @ingroup Image */ | ||
175 | } | ||
176 | values { | ||
177 | Eina_Bool no_scale; /*@ @c EINA_TRUE if the object is not scalable, @c EINA_FALSE | ||
178 | otherwise. Default is @c EINA_FALSE. */ | ||
179 | } | ||
180 | } | ||
181 | animated { | ||
182 | set { | ||
183 | /*@ | ||
184 | Set whether an image object (which supports animation) is to | ||
185 | animate itself or not. | ||
186 | |||
187 | An image object, even if it supports animation, will be displayed | ||
188 | by default without animation. Call this function with @a animated | ||
189 | set to @c EINA_TRUE to enable its animation. To start or stop the | ||
190 | animation, actually, use elm_image_animated_play_set(). | ||
191 | |||
192 | @see elm_image_animated_get() | ||
193 | @see elm_image_animated_available_get() | ||
194 | @see elm_image_animated_play_set() | ||
195 | |||
196 | @ingroup Image | ||
197 | @since 1.7 */ | ||
198 | } | ||
199 | get { | ||
200 | /*@ | ||
201 | Get whether an image object has animation enabled or not. | ||
202 | |||
203 | @return @c EINA_TRUE if the image has animation enabled, | ||
204 | @c EINA_FALSE otherwise. | ||
205 | |||
206 | @see elm_image_animated_set() | ||
207 | |||
208 | @ingroup Image | ||
209 | @since 1.7 */ | ||
210 | } | ||
211 | values { | ||
212 | Eina_Bool anim; /*@ @c EINA_TRUE if the object is to animate itself, | ||
213 | @c EINA_FALSE otherwise. Default is @c EINA_FALSE. */ | ||
214 | } | ||
215 | } | ||
216 | scale { | ||
217 | set { | ||
218 | /*@ No description supplied by the EAPI. */ | ||
219 | } | ||
220 | get { | ||
221 | /*@ No description supplied by the EAPI. */ | ||
222 | } | ||
223 | values { | ||
224 | double scale; | ||
225 | } | ||
226 | } | ||
227 | file { | ||
228 | set { | ||
229 | /*@ | ||
230 | Set the file that will be used as the image's source. | ||
231 | |||
232 | @return (@c EINA_TRUE = success, @c EINA_FALSE = error) | ||
233 | |||
234 | @see elm_image_file_get() | ||
235 | |||
236 | @note This function will trigger the Edje file case based on the | ||
237 | extension of the @a file string (expects @c ".edj", for this | ||
238 | case). | ||
239 | |||
240 | @note If you use animated gif image and create multiple image objects with | ||
241 | one gif image file, you should set the @p group differently for each object. | ||
242 | Or image objects will share one evas image cache entry and you will get | ||
243 | unwanted frames. | ||
244 | |||
245 | @ingroup Image */ | ||
246 | return Eina_Bool; | ||
247 | legacy null; | ||
248 | } | ||
249 | get { | ||
250 | /*@ | ||
251 | Get the file that will be used as image. | ||
252 | |||
253 | @see elm_image_file_set() | ||
254 | |||
255 | @ingroup Image */ | ||
256 | } | ||
257 | values { | ||
258 | const char *file; /*@ The path to file that will be used as image source */ | ||
259 | const char *group; /*@ The group that the image belongs to, in case it's an | ||
260 | EET (including Edje case) file. This can be used as a key inside | ||
261 | evas image cache if this is a normal image file not eet file. */ | ||
262 | } | ||
263 | } | ||
264 | fill_inside { | ||
265 | set { | ||
266 | /*@ No description supplied by the EAPI. */ | ||
267 | } | ||
268 | get { | ||
269 | /*@ No description supplied by the EAPI. */ | ||
270 | } | ||
271 | values { | ||
272 | Eina_Bool fill_inside; | ||
273 | } | ||
274 | } | ||
275 | aspect_fixed { | ||
276 | set { | ||
277 | /*@ | ||
278 | Set whether the original aspect ratio of the image should be kept on resize. | ||
279 | |||
280 | The original aspect ratio (width / height) of the image is usually | ||
281 | distorted to match the object's size. Enabling this option will retain | ||
282 | this original aspect, and the way that the image is fit into the object's | ||
283 | area depends on the option set by elm_image_fill_outside_set(). | ||
284 | |||
285 | @see elm_image_aspect_fixed_get() | ||
286 | @see elm_image_fill_outside_set() | ||
287 | |||
288 | @ingroup Image */ | ||
289 | } | ||
290 | get { | ||
291 | /*@ | ||
292 | Get if the object retains the original aspect ratio. | ||
293 | |||
294 | @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE | ||
295 | otherwise. | ||
296 | |||
297 | @ingroup Image */ | ||
298 | } | ||
299 | values { | ||
300 | Eina_Bool fixed; /*@ @c EINA_TRUE if the image should retain the aspect, | ||
301 | @c EINA_FALSE otherwise. */ | ||
302 | } | ||
303 | } | ||
304 | orient { | ||
305 | set { | ||
306 | /*@ | ||
307 | Set the image orientation. | ||
308 | |||
309 | This function allows to rotate or flip the given image. | ||
310 | |||
311 | @see elm_image_orient_get() | ||
312 | @see @ref Elm_Image_Orient | ||
313 | |||
314 | @ingroup Image */ | ||
315 | } | ||
316 | get { | ||
317 | /*@ | ||
318 | Get the image orientation. | ||
319 | |||
320 | @return The image orientation @ref Elm_Image_Orient | ||
321 | |||
322 | @see elm_image_orient_set() | ||
323 | @see @ref Elm_Image_Orient | ||
324 | |||
325 | @ingroup Image */ | ||
326 | } | ||
327 | values { | ||
328 | Elm_Image_Orient orient; /*@ The image orientation @ref Elm_Image_Orient | ||
329 | Default is #ELM_IMAGE_ORIENT_NONE. */ | ||
330 | } | ||
331 | } | ||
332 | fill_outside { | ||
333 | set { | ||
334 | /*@ | ||
335 | Set if the image fills the entire object area, when keeping the aspect ratio. | ||
336 | |||
337 | When the image should keep its aspect ratio even if resized to another | ||
338 | aspect ratio, there are two possibilities to resize it: keep the entire | ||
339 | image inside the limits of height and width of the object (@p fill_outside | ||
340 | is @c EINA_FALSE) or let the extra width or height go outside of the object, | ||
341 | and the image will fill the entire object (@p fill_outside is @c EINA_TRUE). | ||
342 | |||
343 | @note This option will have no effect if | ||
344 | elm_image_aspect_fixed_set() is set to @c EINA_FALSE. | ||
345 | |||
346 | @see elm_image_fill_outside_get() | ||
347 | @see elm_image_aspect_fixed_set() | ||
348 | |||
349 | @ingroup Image */ | ||
350 | } | ||
351 | get { | ||
352 | /*@ | ||
353 | Get if the object is filled outside | ||
354 | |||
355 | @return @c EINA_TRUE if the object is filled outside, @c EINA_FALSE otherwise. | ||
356 | |||
357 | @see elm_image_fill_outside_set() | ||
358 | |||
359 | @ingroup Image */ | ||
360 | } | ||
361 | values { | ||
362 | Eina_Bool fill_outside; /*@ @c EINA_TRUE if the object is filled outside, | ||
363 | @c EINA_FALSE otherwise. Default is @c EINA_FALSE. */ | ||
364 | } | ||
365 | } | ||
366 | resizable { | ||
367 | set { | ||
368 | /*@ | ||
369 | Set if the object is (up/down) resizable. | ||
370 | |||
371 | This function limits the image resize ability. If @p size_up is set to | ||
372 | @c EINA_FALSE, the object can't have its height or width resized to a value | ||
373 | higher than the original image size. Same is valid for @p size_down. | ||
374 | |||
375 | @see elm_image_resizable_get() | ||
376 | |||
377 | @ingroup Image */ | ||
378 | } | ||
379 | get { | ||
380 | /*@ | ||
381 | Get if the object is (up/down) resizable. | ||
382 | |||
383 | @see elm_image_resizable_set() | ||
384 | |||
385 | @ingroup Image */ | ||
386 | } | ||
387 | values { | ||
388 | Eina_Bool up; /*@ A bool to set if the object is resizable up. Default is | ||
389 | @c EINA_TRUE. */ | ||
390 | Eina_Bool down; /*@ A bool to set if the object is resizable down. Default | ||
391 | is @c EINA_TRUE. */ | ||
392 | } | ||
393 | } | ||
394 | preload_disabled { | ||
395 | set { | ||
396 | /*@ | ||
397 | Enable or disable preloading of the image | ||
398 | |||
399 | @ingroup Image */ | ||
400 | } | ||
401 | values { | ||
402 | Eina_Bool disabled; /*@ If EINA_TRUE, preloading will be disabled */ | ||
403 | } | ||
404 | } | ||
405 | mmap { | ||
406 | set { | ||
407 | /*@ | ||
408 | Set the file that will be used as the image's source. | ||
409 | |||
410 | @return (@c EINA_TRUE = success, @c EINA_FALSE = error) | ||
411 | |||
412 | @see elm_image_file_set() | ||
413 | |||
414 | @note This function will trigger the Edje file case based on the | ||
415 | extension of the @a file string use to create the Eina_File (expects | ||
416 | @c ".edj", for this case). | ||
417 | |||
418 | @note If you use animated gif image and create multiple image objects with | ||
419 | one gif image file, you should set the @p group differently for each object. | ||
420 | Or image objects will share one evas image cache entry and you will get | ||
421 | unwanted frames. | ||
422 | |||
423 | @ingroup Image */ | ||
424 | return Eina_Bool; | ||
425 | legacy null; | ||
426 | } | ||
427 | values { | ||
428 | const Eina_File *file; /*@ The handler to an Eina_File that will be used as image source */ | ||
429 | const char *group; /*@ The group that the image belongs to, in case it's an | ||
430 | EET (including Edje case) file. This can be used as a key inside | ||
431 | evas image cache if this is a normal image file not eet file. */ | ||
432 | } | ||
433 | } | ||
434 | memfile { | ||
435 | set { | ||
436 | /*@ | ||
437 | Set a location in memory to be used as an image object's source | ||
438 | bitmap. | ||
439 | |||
440 | This function is handy when the contents of an image file are | ||
441 | mapped in memory, for example. | ||
442 | |||
443 | The @p format string should be something like @c "png", @c "jpg", | ||
444 | @c "tga", @c "tiff", @c "bmp" etc, when provided (@c NULL, on the | ||
445 | contrary). This improves the loader performance as it tries the | ||
446 | "correct" loader first, before trying a range of other possible | ||
447 | loaders until one succeeds. | ||
448 | |||
449 | @return (@c EINA_TRUE = success, @c EINA_FALSE = error) | ||
450 | |||
451 | @since 1.7 | ||
452 | |||
453 | @ingroup Image */ | ||
454 | return Eina_Bool; | ||
455 | } | ||
456 | values { | ||
457 | const void *img; /*@ The binary data that will be used as image source */ | ||
458 | size_t size; /*@ The size of binary data blob @p img */ | ||
459 | const char *format; /*@ (Optional) expected format of @p img bytes */ | ||
460 | const char *key; /*@ Optional indexing key of @p img to be passed to the | ||
461 | image loader (eg. if @p img is a memory-mapped EET file) */ | ||
462 | } | ||
463 | } | ||
464 | animated_available { | ||
465 | get { | ||
466 | /*@ | ||
467 | Get whether an image object supports animation or not. | ||
468 | |||
469 | @return @c EINA_TRUE if the image supports animation, | ||
470 | @c EINA_FALSE otherwise. | ||
471 | |||
472 | This function returns if this Elementary image object's internal | ||
473 | image can be animated. Currently Evas only supports GIF | ||
474 | animation. If the return value is @b EINA_FALSE, other | ||
475 | @c elm_image_animated_xxx API calls won't work. | ||
476 | |||
477 | @see elm_image_animated_set() | ||
478 | |||
479 | @ingroup Image | ||
480 | @since 1.7 */ | ||
481 | return Eina_Bool; | ||
482 | } | ||
483 | } | ||
484 | object { | ||
485 | get { | ||
486 | /*@ | ||
487 | Get the inlined image object of the image widget. | ||
488 | |||
489 | @return The inlined image object, or NULL if none exists | ||
490 | |||
491 | This function allows one to get the underlying @c Evas_Object of type | ||
492 | Image from this elementary widget. It can be useful to do things like get | ||
493 | the pixel data, save the image to a file, etc. | ||
494 | |||
495 | @note Be careful to not manipulate it, as it is under control of | ||
496 | elementary. | ||
497 | |||
498 | @ingroup Image */ | ||
499 | return Evas_Object *; | ||
500 | } | ||
501 | } | ||
502 | object_size { | ||
503 | get { | ||
504 | /*@ | ||
505 | Get the current size of the image. | ||
506 | |||
507 | This is the real size of the image, not the size of the object. | ||
508 | |||
509 | @ingroup Image */ | ||
510 | } | ||
511 | values { | ||
512 | int w; /*@ Pointer to store width, or NULL. */ | ||
513 | int h; /*@ Pointer to store height, or NULL. */ | ||
514 | } | ||
515 | } | ||
516 | } | ||
517 | methods { | ||
518 | sizing_eval { | ||
519 | /*@ No description supplied by the EAPI. */ | ||
520 | } | ||
521 | } | ||
522 | implements { | ||
523 | class::constructor; | ||
524 | Eo_Base::constructor; | ||
525 | Evas_Smart::hide; | ||
526 | Evas_Smart::clip::set; | ||
527 | Evas_Smart::clip_unset; | ||
528 | Evas_Smart::show; | ||
529 | Evas_Smart::color::set; | ||
530 | Evas_Smart::move; | ||
531 | Evas_Smart::add; | ||
532 | Evas_Smart::del; | ||
533 | Evas_Smart::member_add; | ||
534 | Evas_Smart::resize; | ||
535 | Elm_Widget::theme_apply; | ||
536 | Elm_Widget::event; | ||
537 | } | ||
538 | events { | ||
539 | drop; | ||
540 | clicked; | ||
541 | download,start; | ||
542 | download,progress; | ||
543 | download,done; | ||
544 | download,error; | ||
545 | } | ||
546 | |||
547 | } | ||