summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-03-15 16:19:12 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-03-17 13:10:35 +0900
commit6ac68c92526c21aec48cf584b23f34ef45dc5ee5 (patch)
tree884333f19acfdd6232f22de9630014e5f86062db /src
parent6b03d46d545ec228708ace4bebeff85704f3f1be (diff)
Evas.Image: Move all legacy EAPI out of evas_object_image.c
Some of these functions are still be in use by the new EO objects, like data_set/get/copy_set.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Evas.am1
-rw-r--r--src/lib/evas/canvas/evas_image_legacy.c824
-rw-r--r--src/lib/evas/canvas/evas_image_private.h11
-rw-r--r--src/lib/evas/canvas/evas_object_image.c883
4 files changed, 857 insertions, 862 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index d1588aaee2..57fe9c4546 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -153,6 +153,7 @@ lib/evas/canvas/evas_key_grab.c \
153lib/evas/canvas/evas_layer.c \ 153lib/evas/canvas/evas_layer.c \
154lib/evas/canvas/evas_main.c \ 154lib/evas/canvas/evas_main.c \
155lib/evas/canvas/evas_name.c \ 155lib/evas/canvas/evas_name.c \
156lib/evas/canvas/evas_image_legacy.c \
156lib/evas/canvas/evas_object_image.c \ 157lib/evas/canvas/evas_object_image.c \
157lib/evas/canvas/evas_object_main.c \ 158lib/evas/canvas/evas_object_main.c \
158lib/evas/canvas/evas_object_inform.c \ 159lib/evas/canvas/evas_object_inform.c \
diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c
new file mode 100644
index 0000000000..351ae9112d
--- /dev/null
+++ b/src/lib/evas/canvas/evas_image_legacy.c
@@ -0,0 +1,824 @@
1#include "evas_image_private.h"
2
3#define EVAS_IMAGE_LEGACY_API(_o, ...) \
4 do { EVAS_OBJECT_LEGACY_API(_o, __VA_ARGS__); \
5 if (EINA_UNLIKELY(!eo_isa(_o, EVAS_IMAGE_CLASS))) { \
6 EINA_SAFETY_ERROR("object is not an image!"); \
7 return __VA_ARGS__; \
8 } } while(0)
9
10EAPI Evas_Object *
11evas_object_image_add(Evas *eo_e)
12{
13 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
14 return eo_add(EVAS_IMAGE_CLASS, eo_e,
15 efl_gfx_fill_filled_set(eo_self, EINA_FALSE),
16 evas_obj_legacy_ctor(eo_self));
17}
18
19EAPI Evas_Object *
20evas_object_image_filled_add(Evas *eo_e)
21{
22 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
23 return eo_add(EVAS_IMAGE_CLASS, eo_e,
24 evas_obj_legacy_ctor(eo_self));
25}
26
27EAPI void
28evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *format EINA_UNUSED, char *key)
29{
30 Eina_File *f;
31
32 EVAS_IMAGE_LEGACY_API(eo_obj);
33
34 f = eina_file_virtualize(NULL, data, size, EINA_TRUE);
35 if (!f) return ;
36 efl_file_mmap_set(eo_obj, f, key);
37 eina_file_close(f);
38}
39
40EAPI void
41evas_object_image_fill_set(Evas_Image *obj,
42 Evas_Coord x, Evas_Coord y,
43 Evas_Coord w, Evas_Coord h)
44{
45 efl_gfx_fill_set((Evas_Image *)obj, x, y, w, h);
46}
47
48EAPI void
49evas_object_image_preload(Evas_Object *eo_obj, Eina_Bool cancel)
50{
51 if (cancel)
52 efl_image_load_async_cancel(eo_obj);
53 else
54 efl_image_load_async_start(eo_obj);
55}
56
57EAPI Eina_Bool
58evas_object_image_filled_get(const Evas_Object *eo_obj)
59{
60 return efl_gfx_fill_filled_get(eo_obj);
61}
62
63EAPI void
64evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value)
65{
66 efl_gfx_fill_filled_set(eo_obj, value);
67}
68
69EAPI void
70evas_object_image_fill_get(const Evas_Image *obj,
71 Evas_Coord *x, Evas_Coord *y,
72 Evas_Coord *w, Evas_Coord *h)
73{
74 efl_gfx_fill_get(obj, x, y, w, h);
75}
76
77EAPI void
78evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha)
79{
80 EVAS_IMAGE_LEGACY_API(obj);
81 efl_gfx_buffer_alpha_set(obj, alpha);
82}
83
84EAPI Eina_Bool
85evas_object_image_alpha_get(const Evas_Object *obj)
86{
87 EVAS_IMAGE_LEGACY_API(obj, EINA_FALSE);
88 return efl_gfx_buffer_alpha_get(obj);
89}
90
91EAPI void
92evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b)
93{
94 efl_image_border_set(obj, l, r, t, b);
95}
96
97EAPI void
98evas_object_image_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b)
99{
100 efl_image_border_get(obj, l, r, t, b);
101}
102
103EAPI void
104evas_object_image_border_scale_set(Evas_Object *obj, double scale)
105{
106 efl_image_border_scale_set(obj, scale);
107}
108
109EAPI double
110evas_object_image_border_scale_get(const Evas_Object *obj)
111{
112 return efl_image_border_scale_get(obj);
113}
114
115EAPI void
116evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill)
117{
118 efl_image_border_center_fill_set(obj, (Efl_Gfx_Border_Fill_Mode) fill);
119}
120
121EAPI Evas_Border_Fill_Mode
122evas_object_image_border_center_fill_get(const Evas_Object *obj)
123{
124 return (Evas_Border_Fill_Mode) efl_image_border_center_fill_get(obj);
125}
126
127EAPI void
128evas_object_image_size_get(const Evas_Image *obj, int *w, int *h)
129{
130 efl_gfx_view_size_get(obj, w, h);
131}
132
133EAPI Evas_Colorspace
134evas_object_image_colorspace_get(const Evas_Object *obj)
135{
136 return (Evas_Colorspace) efl_gfx_buffer_colorspace_get(obj);
137}
138
139EAPI int
140evas_object_image_stride_get(const Evas_Object *obj)
141{
142 return efl_gfx_buffer_stride_get(obj);
143}
144
145EAPI void
146evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h)
147{
148 efl_gfx_buffer_update_add(obj, x, y, w, h);
149}
150
151EAPI void
152evas_object_image_file_set(Eo *obj, const char *file, const char *key)
153{
154 efl_file_set(obj, file, key);
155}
156
157EAPI void
158evas_object_image_file_get(const Eo *obj, const char **file, const char **key)
159{
160 efl_file_get(obj, file, key);
161}
162
163EAPI void
164evas_object_image_mmap_set(Evas_Image *obj, const Eina_File *f, const char *key)
165{
166 efl_file_mmap_set(obj, f, key);
167}
168
169EAPI void
170evas_object_image_mmap_get(const Evas_Image *obj, const Eina_File **f, const char **key)
171{
172 efl_file_mmap_get(obj, f, key);
173}
174
175EAPI Eina_Bool
176evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags)
177{
178 return efl_file_save(obj, file, key, flags);
179}
180
181EAPI Eina_Bool
182evas_object_image_animated_get(const Eo *obj)
183{
184 return efl_image_animated_get(obj);
185}
186
187EAPI void
188evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index)
189{
190 efl_image_animated_frame_set(obj, frame_index);
191}
192
193EAPI int
194evas_object_image_animated_frame_count_get(const Evas_Object *obj)
195{
196 return efl_image_animated_frame_count_get(obj);
197}
198
199EAPI Evas_Image_Animated_Loop_Hint
200evas_object_image_animated_loop_type_get(const Evas_Object *obj)
201{
202 return (Evas_Image_Animated_Loop_Hint) efl_image_animated_loop_type_get(obj);
203}
204
205EAPI int
206evas_object_image_animated_loop_count_get(const Evas_Object *obj)
207{
208 return efl_image_animated_loop_count_get(obj);
209}
210
211EAPI double
212evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int frame_num)
213{
214 return efl_image_animated_frame_duration_get(obj, start_frame, frame_num);
215}
216
217EAPI void
218evas_object_image_load_size_set(Eo *obj, int w, int h)
219{
220 efl_image_load_size_set(obj, w, h);
221}
222
223EAPI void
224evas_object_image_load_size_get(const Eo *obj, int *w, int *h)
225{
226 efl_image_load_size_get(obj, w, h);
227}
228
229EAPI void
230evas_object_image_load_dpi_set(Evas_Object *obj, double dpi)
231{
232 efl_image_load_dpi_set(obj, dpi);
233}
234
235EAPI double
236evas_object_image_load_dpi_get(const Evas_Object *obj)
237{
238 return efl_image_load_dpi_get(obj);
239}
240
241EAPI void
242evas_object_image_load_region_set(Evas_Object *obj, int x, int y, int w, int h)
243{
244 efl_image_load_region_set(obj, x, y, w, h);
245}
246
247EAPI void
248evas_object_image_load_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
249{
250 efl_image_load_region_get(obj, x, y, w, h);
251}
252
253EAPI Eina_Bool
254evas_object_image_region_support_get(const Evas_Image *obj)
255{
256 return efl_image_load_region_support_get(obj);
257}
258
259EAPI void
260evas_object_image_load_orientation_set(Evas_Object *obj, Eina_Bool enable)
261{
262 efl_image_load_orientation_set(obj, enable);
263}
264
265EAPI Eina_Bool
266evas_object_image_load_orientation_get(const Evas_Object *obj)
267{
268 return efl_image_load_orientation_get(obj);
269}
270
271EAPI void
272evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down)
273{
274 efl_image_load_scale_down_set(obj, scale_down);
275}
276
277EAPI int
278evas_object_image_load_scale_down_get(const Evas_Object *obj)
279{
280 return efl_image_load_scale_down_get(obj);
281}
282
283EAPI Evas_Load_Error
284evas_object_image_load_error_get(const Evas_Object *obj)
285{
286 return (Evas_Load_Error) efl_image_load_error_get(obj);
287}
288
289EAPI void
290evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale)
291{
292 efl_image_smooth_scale_set(obj, smooth_scale);
293}
294
295EAPI Eina_Bool
296evas_object_image_smooth_scale_get(const Eo *obj)
297{
298 return efl_image_smooth_scale_get(obj);
299}
300
301EAPI void
302evas_object_image_orient_set(Evas_Image *obj, Evas_Image_Orient orient)
303{
304 efl_image_orientation_set(obj, (Efl_Gfx_Orientation) orient);
305}
306
307EAPI Evas_Image_Orient
308evas_object_image_orient_get(const Evas_Image *obj)
309{
310 return (Evas_Image_Orient) efl_image_orientation_get(obj);
311}
312
313EAPI void
314evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s)
315{
316 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
317
318 EVAS_IMAGE_LEGACY_API(eo);
319 if (obj->cur->snapshot == s) return;
320
321 EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
322 state_write->snapshot = !!s;
323 EINA_COW_STATE_WRITE_END(obj, state_write, cur);
324}
325
326EAPI Eina_Bool
327evas_object_image_snapshot_get(const Evas_Object *eo)
328{
329 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
330 EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE);
331 return obj->cur->snapshot;
332}
333
334EAPI Eina_Bool
335evas_object_image_source_set(Evas_Object *eo, Evas_Object *src)
336{
337 EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE);
338 return _evas_image_proxy_source_set(eo, src);
339}
340
341EAPI Evas_Object *
342evas_object_image_source_get(const Evas_Object *eo)
343{
344 EVAS_IMAGE_LEGACY_API(eo, NULL);
345 return _evas_image_proxy_source_get(eo);
346}
347
348EAPI Eina_Bool
349evas_object_image_source_unset(Evas_Object *eo_obj)
350{
351 EVAS_IMAGE_LEGACY_API(eo_obj, EINA_FALSE);
352 return _evas_image_proxy_source_set(eo_obj, NULL);
353}
354
355EAPI void
356evas_object_image_source_clip_set(Evas_Object *eo, Eina_Bool source_clip)
357{
358 EVAS_IMAGE_LEGACY_API(eo);
359 _evas_image_proxy_source_clip_set(eo, source_clip);
360}
361
362EAPI Eina_Bool
363evas_object_image_source_clip_get(const Evas_Object *eo)
364{
365 EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE);
366 return _evas_image_proxy_source_clip_get(eo);
367}
368
369EAPI void
370evas_object_image_source_events_set(Evas_Object *eo, Eina_Bool repeat)
371{
372 EVAS_IMAGE_LEGACY_API(eo);
373 _evas_image_proxy_source_events_set(eo, repeat);
374}
375
376EAPI Eina_Bool
377evas_object_image_source_events_get(const Evas_Object *eo)
378{
379 EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE);
380 return _evas_image_proxy_source_events_get(eo);
381}
382
383EAPI void
384evas_object_image_content_hint_set(Evas_Object *obj, Evas_Image_Content_Hint hint)
385{
386 return efl_image_content_hint_set(obj, hint);
387}
388
389EAPI Evas_Image_Content_Hint
390evas_object_image_content_hint_get(const Evas_Object *obj)
391{
392 return efl_image_content_hint_get(obj);
393}
394
395EAPI void
396evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint)
397{
398 return efl_image_scale_hint_set(obj, (Efl_Image_Scale_Hint) hint);
399}
400
401EAPI Evas_Image_Scale_Hint
402evas_object_image_scale_hint_get(const Evas_Object *obj)
403{
404 return (Evas_Image_Scale_Hint) efl_image_scale_hint_get(obj);
405}
406
407EAPI void
408evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *surf)
409{
410 EVAS_IMAGE_LEGACY_API(eo_obj);
411 _evas_image_native_surface_set(eo_obj, surf);
412}
413
414EAPI Evas_Native_Surface *
415evas_object_image_native_surface_get(const Evas_Object *eo_obj)
416{
417 EVAS_IMAGE_LEGACY_API(eo_obj, NULL);
418 return _evas_image_native_surface_get(eo_obj);
419}
420
421/* eo equivalent: pixels_set(null, w, h, cspace) to (re)allocate an image */
422EAPI void
423evas_object_image_size_set(Eo *eo_obj, int w, int h)
424{
425 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
426 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
427
428 int stride = 0;
429
430 if (o->cur->scene) return;
431
432 evas_object_async_block(obj);
433 _evas_image_cleanup(eo_obj, obj, o);
434 if (w < 1) w = 1;
435 if (h < 1) h = 1;
436 if (w >= 32768) return;
437 if (h >= 32768) return;
438 if ((w == o->cur->image.w) &&
439 (h == o->cur->image.h)) return;
440
441 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
442 {
443 state_write->image.w = w;
444 state_write->image.h = h;
445 }
446 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
447
448 if (o->engine_data)
449 o->engine_data = ENFN->image_size_set(ENDT, o->engine_data, w, h);
450 else
451 o->engine_data = ENFN->image_new_from_copied_data
452 (ENDT, w, h, NULL, o->cur->has_alpha, o->cur->cspace);
453
454 if (o->engine_data)
455 {
456 if (ENFN->image_scale_hint_set)
457 ENFN->image_scale_hint_set(ENDT, o->engine_data, o->scale_hint);
458 if (ENFN->image_content_hint_set)
459 ENFN->image_content_hint_set(ENDT, o->engine_data, o->content_hint);
460 if (ENFN->image_stride_get)
461 ENFN->image_stride_get(ENDT, o->engine_data, &stride);
462 else
463 stride = w * 4;
464 }
465 else
466 stride = w * 4;
467 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, cur_write)
468 {
469 cur_write->image.stride = stride;
470
471/* FIXME - in engine call above
472 if (o->engine_data)
473 o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
474*/
475 EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write)
476 EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur_write, prev_write);
477 EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write);
478 }
479 EINA_COW_IMAGE_STATE_WRITE_END(o, cur_write);
480
481 o->written = EINA_TRUE;
482 o->changed = EINA_TRUE;
483 evas_object_inform_call_image_resize(eo_obj);
484 evas_object_change(eo_obj, obj);
485}
486
487/* eo equivalent: pixels_set(null, w, h, cspace) to (re)allocate an image */
488EAPI void
489evas_object_image_colorspace_set(Evas_Object *eo_obj, Evas_Colorspace cspace)
490{
491 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
492 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
493 evas_object_async_block(obj);
494
495 _evas_image_cleanup(eo_obj, obj, o);
496
497 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
498 state_write->cspace = cspace;
499 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
500
501 if (o->engine_data)
502 ENFN->image_colorspace_set(ENDT, o->engine_data, cspace);
503}
504
505/* old video surfaces */
506
507EAPI void
508evas_object_image_video_surface_set(Evas_Object *eo_obj, Evas_Video_Surface *surf)
509{
510 EVAS_IMAGE_LEGACY_API(eo_obj);
511
512 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
513 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
514 evas_object_async_block(obj);
515
516 _evas_image_cleanup(eo_obj, obj, o);
517 if (o->video_surface)
518 {
519 o->video_surface = EINA_FALSE;
520 obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, eo_obj);
521 }
522
523 if (surf)
524 {
525 if (surf->version != EVAS_VIDEO_SURFACE_VERSION) return;
526
527 if (!surf->update_pixels ||
528 !surf->move ||
529 !surf->resize ||
530 !surf->hide ||
531 !surf->show)
532 return;
533
534 o->created = EINA_TRUE;
535 o->video_surface = EINA_TRUE;
536
537 EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
538 pixi_write->video = *surf;
539 EINA_COW_PIXEL_WRITE_END(o, pixi_write)
540
541 obj->layer->evas->video_objects = eina_list_append(obj->layer->evas->video_objects, eo_obj);
542 }
543 else
544 {
545 if (!o->video_surface &&
546 !o->pixels->video.update_pixels &&
547 !o->pixels->video.move &&
548 !o->pixels->video.resize &&
549 !o->pixels->video.hide &&
550 !o->pixels->video.show &&
551 !o->pixels->video.data)
552 return;
553
554 o->video_surface = EINA_FALSE;
555 EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
556 {
557 pixi_write->video.update_pixels = NULL;
558 pixi_write->video.move = NULL;
559 pixi_write->video.resize = NULL;
560 pixi_write->video.hide = NULL;
561 pixi_write->video.show = NULL;
562 pixi_write->video.data = NULL;
563 }
564 EINA_COW_PIXEL_WRITE_END(o, pixi_write)
565 }
566}
567
568EAPI const Evas_Video_Surface*
569evas_object_image_video_surface_get(const Evas_Object *eo_obj)
570{
571 EVAS_IMAGE_LEGACY_API(eo_obj, NULL);
572
573 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
574 return (!o->video_surface ? NULL : &o->pixels->video);
575}
576
577EAPI void
578evas_object_image_video_surface_caps_set(Evas_Object *eo_obj, unsigned int caps)
579{
580 EVAS_IMAGE_LEGACY_API(eo_obj);
581
582 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
583 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
584 evas_object_async_block(obj);
585
586 _evas_image_cleanup(eo_obj, obj, o);
587
588 if (caps == o->pixels->video_caps)
589 return;
590
591 EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
592 pixi_write->video_caps = caps;
593 EINA_COW_PIXEL_WRITE_END(o, pixi_write)
594}
595
596EAPI unsigned int
597evas_object_image_video_surface_caps_get(const Evas_Object *eo_obj)
598{
599 EVAS_IMAGE_LEGACY_API(eo_obj, 0);
600
601 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
602 return (!o->video_surface ? 0 : o->pixels->video_caps);
603}
604
605/* deprecated */
606EAPI void
607evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread spread)
608{
609 /* not implemented! */
610 if (spread != EFL_GFX_FILL_REPEAT)
611 WRN("Fill spread support is not implemented!");
612}
613
614/* deprecated */
615EAPI Evas_Fill_Spread
616evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED)
617{
618 return EFL_GFX_FILL_REPEAT;
619}
620
621/* deprecated */
622EAPI void
623evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible)
624{
625 /* FIXME: I'd love to remove this feature and replace by no_render.
626 * But they are not 100% equivalent: if all proxies are removed, then the
627 * source becomes visible again. This has some advantages for some apps but
628 * it's complete hell to handle in evas render side.
629 * -- jpeg, 2016/03/07
630 */
631
632 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
633 Evas_Object_Protected_Data *src_obj;
634 Evas_Image_Data *o;
635
636 EVAS_IMAGE_LEGACY_API(eo);
637
638 o = eo_data_scope_get(eo, EVAS_IMAGE_CLASS);
639 if (!o->cur->source) return;
640
641 visible = !!visible;
642 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
643 if (src_obj->proxy->src_invisible == !visible) return;
644
645 evas_object_async_block(obj);
646 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, Evas_Object_Proxy_Data, proxy_write)
647 proxy_write->src_invisible = !visible;
648 EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write);
649
650 src_obj->changed_src_visible = EINA_TRUE;
651 evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
652 EINA_FALSE, EINA_TRUE);
653 evas_object_change(o->cur->source, src_obj);
654 if ((!visible) || (!src_obj->proxy->src_events)) return;
655 //FIXME: Feed mouse events here.
656}
657
658/* deprecated */
659EAPI Eina_Bool
660evas_object_image_source_visible_get(const Evas_Object *eo)
661{
662 /* FIXME: see evas_object_image_source_visible_set */
663
664 Evas_Object_Protected_Data *src_obj;
665 Evas_Image_Data *o;
666 Eina_Bool visible;
667
668 EVAS_IMAGE_LEGACY_API(eo, EINA_FALSE);
669
670 o = eo_data_scope_get(eo, EVAS_IMAGE_CLASS);
671 if (!o->cur->source) visible = EINA_FALSE;
672 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
673 if (src_obj) visible = !src_obj->proxy->src_invisible;
674 else visible = EINA_FALSE;
675
676 return visible;
677}
678
679/* deprecated */
680EAPI void*
681evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace)
682{
683 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
684 Evas_Image_Data *o;
685 DATA32 *data;
686 void* result = NULL;
687
688 EVAS_IMAGE_LEGACY_API(eo_obj, NULL);
689 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_obj, EVAS_IMAGE_CLASS), NULL);
690
691 evas_object_async_block(obj);
692 o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
693 if ((o->preloading) && (o->engine_data))
694 {
695 o->preloading = EINA_FALSE;
696 ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
697 }
698 if (!o->engine_data) return NULL;
699 if (o->video_surface)
700 o->pixels->video.update_pixels(o->pixels->video.data, eo_obj, &o->pixels->video);
701 if (o->cur->cspace == to_cspace) return NULL;
702 data = NULL;
703 o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error, NULL);
704 result = _evas_image_data_convert_internal(o, data, to_cspace);
705 if (o->engine_data)
706 {
707 o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, data);
708 }
709
710 return result;
711}
712
713/* deprecated */
714EAPI void
715evas_object_image_reload(Eo *eo_obj)
716{
717 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
718 Evas_Image_Data *o;
719
720 EVAS_IMAGE_LEGACY_API(eo_obj);
721 EINA_SAFETY_ON_FALSE_RETURN(eo_isa(eo_obj, EVAS_IMAGE_CLASS));
722
723 evas_object_async_block(obj);
724 o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
725 if ((o->preloading) && (o->engine_data))
726 {
727 o->preloading = EINA_FALSE;
728 ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
729 }
730 if ((!o->cur->u.file) ||
731 (o->pixels_checked_out > 0)) return;
732 if (o->engine_data)
733 o->engine_data = ENFN->image_dirty_region(ENDT, o->engine_data, 0, 0, o->cur->image.w, o->cur->image.h);
734 o->written = EINA_FALSE;
735 _evas_image_unload(eo_obj, obj, 1);
736 evas_object_inform_call_image_unloaded(eo_obj);
737 _evas_image_load(eo_obj, obj, o);
738
739 EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write)
740 {
741 prev_write->u.file = NULL;
742 prev_write->key = NULL;
743 }
744 EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write);
745
746 o->changed = EINA_TRUE;
747 evas_object_change(eo_obj, obj);
748}
749
750/* deprecated */
751EAPI Eina_Bool
752evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *pixels)
753{
754 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
755 Evas_Image_Data *o;
756
757 EVAS_IMAGE_LEGACY_API(eo_obj, EINA_FALSE);
758 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_obj, EVAS_IMAGE_CLASS), EINA_FALSE);
759
760 evas_object_async_block(obj);
761 o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
762 _evas_image_cleanup(eo_obj, obj, o);
763 if ((pixels->w != o->cur->image.w) || (pixels->h != o->cur->image.h)) return EINA_FALSE;
764
765 switch (pixels->format)
766 {
767#if 0
768 case EVAS_PIXEL_FORMAT_ARGB32:
769 {
770 if (o->engine_data)
771 {
772 DATA32 *image_pixels = NULL;
773
774 o->engine_data =
775 ENFN->image_data_get(ENDT,
776 o->engine_data,
777 1,
778 &image_pixels,
779 &o->load_error);
780/* FIXME: need to actualyl support this */
781/* memcpy(image_pixels, pixels->rows, o->cur->image.w * o->cur->image.h * 4);*/
782 if (o->engine_data)
783 o->engine_data =
784 ENFN->image_data_put(ENDT, o->engine_data, image_pixels);
785 if (o->engine_data)
786 o->engine_data =
787 ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
788 o->changed = EINA_TRUE;
789 evas_object_change(eo_obj, obj);
790 }
791 }
792 break;
793#endif
794 case EVAS_PIXEL_FORMAT_YUV420P_601:
795 {
796 if (o->engine_data)
797 {
798 DATA32 *image_pixels = NULL;
799
800 o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error, NULL);
801 if (image_pixels)
802 evas_common_convert_yuv_422p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h);
803 if (o->engine_data)
804 o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, image_pixels);
805 if (o->engine_data)
806 o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
807 o->changed = EINA_TRUE;
808 evas_object_change(eo_obj, obj);
809 }
810 }
811 break;
812 default:
813 return EINA_FALSE;
814 break;
815 }
816 return EINA_TRUE;
817}
818
819/* deprecated */
820EAPI void
821evas_object_image_alpha_mask_set(Evas_Object *eo_obj EINA_UNUSED, Eina_Bool ismask EINA_UNUSED)
822{
823 DBG("This function is not implemented, has never been and never will be.");
824}
diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h
index 9ccff4a736..3a33961a93 100644
--- a/src/lib/evas/canvas/evas_image_private.h
+++ b/src/lib/evas/canvas/evas_image_private.h
@@ -155,6 +155,11 @@ Eina_Bool _evas_image_proxy_source_events_get(const Eo *eo_obj);
155Eina_Bool _evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf); 155Eina_Bool _evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf);
156Evas_Native_Surface *_evas_image_native_surface_get(const Evas_Object *eo_obj); 156Evas_Native_Surface *_evas_image_native_surface_get(const Evas_Object *eo_obj);
157 157
158/* deprecated but in use */
159void *_evas_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace);
160void _evas_image_unload(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool dirty);
161void _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o);
162
158/* save typing */ 163/* save typing */
159#define ENFN obj->layer->evas->engine.func 164#define ENFN obj->layer->evas->engine.func
160#define ENDT obj->layer->evas->engine.data.output 165#define ENDT obj->layer->evas->engine.data.output
@@ -165,6 +170,12 @@ Evas_Native_Surface *_evas_image_native_surface_get(const Evas_Object *eo_obj);
165# define EINA_COW_IMAGE_STATE_WRITE_END(Obj, Write) \ 170# define EINA_COW_IMAGE_STATE_WRITE_END(Obj, Write) \
166 EINA_COW_WRITE_END(evas_object_image_state_cow, Obj->cur, Write) 171 EINA_COW_WRITE_END(evas_object_image_state_cow, Obj->cur, Write)
167 172
173# define EINA_COW_PIXEL_WRITE_BEGIN(Obj, Write) \
174 EINA_COW_WRITE_BEGIN(evas_object_image_pixels_cow, Obj->pixels, Evas_Object_Image_Pixels, Write)
175
176# define EINA_COW_PIXEL_WRITE_END(Obj, Write) \
177 EINA_COW_WRITE_END(evas_object_image_pixels_cow, Obj->pixels, Write)
178
168#define FRAME_MAX 1024 179#define FRAME_MAX 1024
169 180
170#endif // EVAS_IMAGE_PRIVATE_H 181#endif // EVAS_IMAGE_PRIVATE_H
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 8b78241cdb..9abf1c9d6d 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -9,8 +9,6 @@ static const char o_type[] = "image";
9const char *o_image_type = o_type; 9const char *o_image_type = o_type;
10 10
11/* private methods for image objects */ 11/* private methods for image objects */
12static void evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty);
13static void evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o);
14static Evas_Coord evas_object_image_figure_x_fill(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret); 12static Evas_Coord evas_object_image_figure_x_fill(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret);
15static Evas_Coord evas_object_image_figure_y_fill(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret); 13static Evas_Coord evas_object_image_figure_y_fill(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret);
16 14
@@ -54,7 +52,6 @@ static int evas_object_image_get_opaque_rect(Evas_Object *eo_obj,
54 Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); 52 Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
55static int evas_object_image_can_map(Evas_Object *eo_obj); 53static int evas_object_image_can_map(Evas_Object *eo_obj);
56 54
57static void *evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace);
58static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, Evas_Object *eo_obj, void *einfo); 55static void evas_object_image_filled_resize_listener(void *data, Evas *eo_e, Evas_Object *eo_obj, void *einfo);
59 56
60static const Evas_Object_Func object_func = 57static const Evas_Object_Func object_func =
@@ -114,12 +111,6 @@ Eina_Cow *evas_object_image_load_opts_cow = NULL;
114Eina_Cow *evas_object_image_pixels_cow = NULL; 111Eina_Cow *evas_object_image_pixels_cow = NULL;
115Eina_Cow *evas_object_image_state_cow = NULL; 112Eina_Cow *evas_object_image_state_cow = NULL;
116 113
117# define EINA_COW_PIXEL_WRITE_BEGIN(Obj, Write) \
118 EINA_COW_WRITE_BEGIN(evas_object_image_pixels_cow, Obj->pixels, Evas_Object_Image_Pixels, Write)
119
120# define EINA_COW_PIXEL_WRITE_END(Obj, Write) \
121 EINA_COW_WRITE_END(evas_object_image_pixels_cow, Obj->pixels, Write)
122
123# define EINA_COW_LOAD_OPTS_WRITE_BEGIN(Obj, Write) \ 114# define EINA_COW_LOAD_OPTS_WRITE_BEGIN(Obj, Write) \
124 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, Obj->load_opts, Evas_Object_Image_Load_Opts, Write) 115 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, Obj->load_opts, Evas_Object_Image_Load_Opts, Write)
125 116
@@ -233,21 +224,6 @@ _evas_image_eo_base_finalize(Eo *eo_obj, Evas_Image_Data *o)
233 return eo_finalize(eo_super(eo_obj, MY_CLASS)); 224 return eo_finalize(eo_super(eo_obj, MY_CLASS));
234} 225}
235 226
236EAPI void
237evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *format EINA_UNUSED, char *key)
238{
239 Eina_File *f;
240
241 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
242 return;
243 MAGIC_CHECK_END();
244
245 f = eina_file_virtualize(NULL, data, size, EINA_TRUE);
246 if (!f) return ;
247 efl_file_mmap_set(eo_obj, f, key);
248 eina_file_close(f);
249}
250
251void 227void
252_evas_image_init_set(const Eina_File *f, const char *file, const char *key, 228_evas_image_init_set(const Eina_File *f, const char *file, const char *key,
253 Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o, 229 Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o,
@@ -526,7 +502,7 @@ _evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *ro
526 EO_DBG_INFO_APPEND(group, "Source", EINA_VALUE_TYPE_UINT64, 502 EO_DBG_INFO_APPEND(group, "Source", EINA_VALUE_TYPE_UINT64,
527 (uint64_t) (uintptr_t) evas_object_image_source_get(eo_obj)); 503 (uint64_t) (uintptr_t) evas_object_image_source_get(eo_obj));
528 504
529 if (evas_object_image_load_error_get(eo_obj) != EVAS_LOAD_ERROR_NONE) 505 if (efl_image_load_error_get(eo_obj) != EVAS_LOAD_ERROR_NONE)
530 { 506 {
531 Evas_Load_Error error = EVAS_LOAD_ERROR_GENERIC; 507 Evas_Load_Error error = EVAS_LOAD_ERROR_GENERIC;
532 error = (Evas_Load_Error) efl_image_load_error_get(eo_obj); 508 error = (Evas_Load_Error) efl_image_load_error_get(eo_obj);
@@ -687,72 +663,6 @@ _evas_image_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o,
687 if (h) *h = o->cur->fill.h; 663 if (h) *h = o->cur->fill.h;
688} 664}
689 665
690/* eo equivalent: pixels_set(null, w, h) to (re)allocate an image */
691EAPI void
692evas_object_image_size_set(Eo *eo_obj, int w, int h)
693{
694 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
695 Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
696
697 int stride = 0;
698
699 if (o->cur->scene) return;
700
701 evas_object_async_block(obj);
702 _evas_image_cleanup(eo_obj, obj, o);
703 if (w < 1) w = 1;
704 if (h < 1) h = 1;
705 if (w >= 32768) return;
706 if (h >= 32768) return;
707 if ((w == o->cur->image.w) &&
708 (h == o->cur->image.h)) return;
709
710 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
711 {
712 state_write->image.w = w;
713 state_write->image.h = h;
714 }
715 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
716
717 if (o->engine_data)
718 o->engine_data = ENFN->image_size_set(ENDT, o->engine_data, w, h);
719 else
720 o->engine_data = ENFN->image_new_from_copied_data
721 (ENDT, w, h, NULL, o->cur->has_alpha, o->cur->cspace);
722
723 if (o->engine_data)
724 {
725 if (ENFN->image_scale_hint_set)
726 ENFN->image_scale_hint_set(ENDT, o->engine_data, o->scale_hint);
727 if (ENFN->image_content_hint_set)
728 ENFN->image_content_hint_set(ENDT, o->engine_data, o->content_hint);
729 if (ENFN->image_stride_get)
730 ENFN->image_stride_get(ENDT, o->engine_data, &stride);
731 else
732 stride = w * 4;
733 }
734 else
735 stride = w * 4;
736 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, cur_write)
737 {
738 cur_write->image.stride = stride;
739
740/* FIXME - in engine call above
741 if (o->engine_data)
742 o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
743*/
744 EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write)
745 EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur_write, prev_write);
746 EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write);
747 }
748 EINA_COW_IMAGE_STATE_WRITE_END(o, cur_write);
749
750 o->written = EINA_TRUE;
751 o->changed = EINA_TRUE;
752 evas_object_inform_call_image_resize(eo_obj);
753 evas_object_change(eo_obj, obj);
754}
755
756EOLIAN static void 666EOLIAN static void
757_evas_image_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o, int *w, int *h) 667_evas_image_efl_gfx_view_view_size_get(Eo *eo_obj, Evas_Image_Data *o, int *w, int *h)
758{ 668{
@@ -807,43 +717,6 @@ _evas_image_efl_image_load_load_error_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Dat
807 return (Efl_Image_Load_Error) o->load_error; 717 return (Efl_Image_Load_Error) o->load_error;
808} 718}
809 719
810/* deprecated */
811EAPI void*
812evas_object_image_data_convert(Evas_Object *eo_obj, Evas_Colorspace to_cspace)
813{
814 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
815 Evas_Image_Data *o;
816 DATA32 *data;
817 void* result = NULL;
818
819 if (!eo_isa(eo_obj, MY_CLASS))
820 {
821 CRI("Object is not an %s!", eo_class_name_get(MY_CLASS));
822 return NULL;
823 }
824
825 evas_object_async_block(obj);
826 o = eo_data_scope_get(eo_obj, MY_CLASS);
827 if ((o->preloading) && (o->engine_data))
828 {
829 o->preloading = EINA_FALSE;
830 ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
831 }
832 if (!o->engine_data) return NULL;
833 if (o->video_surface)
834 o->pixels->video.update_pixels(o->pixels->video.data, eo_obj, &o->pixels->video);
835 if (o->cur->cspace == to_cspace) return NULL;
836 data = NULL;
837 o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error, NULL);
838 result = evas_object_image_data_convert_internal(o, data, to_cspace);
839 if (o->engine_data)
840 {
841 o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, data);
842 }
843
844 return result;
845}
846
847static void 720static void
848_image_preload_internal(Eo *eo_obj, void *_pd, Eina_Bool cancel) 721_image_preload_internal(Eo *eo_obj, void *_pd, Eina_Bool cancel)
849{ 722{
@@ -1017,46 +890,6 @@ _evas_image_efl_image_ratio_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
1017 return (double) o->cur->image.w / (double) o->cur->image.h; 890 return (double) o->cur->image.w / (double) o->cur->image.h;
1018} 891}
1019 892
1020/* deprecated */
1021EAPI void
1022evas_object_image_reload(Eo *eo_obj)
1023{
1024 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
1025 Evas_Image_Data *o;
1026
1027 if (!eo_isa(eo_obj, MY_CLASS))
1028 {
1029 CRI("Object is not an %s!", eo_class_name_get(MY_CLASS));
1030 return;
1031 }
1032
1033 evas_object_async_block(obj);
1034 o = eo_data_scope_get(eo_obj, MY_CLASS);
1035 if ((o->preloading) && (o->engine_data))
1036 {
1037 o->preloading = EINA_FALSE;
1038 ENFN->image_data_preload_cancel(ENDT, o->engine_data, eo_obj);
1039 }
1040 if ((!o->cur->u.file) ||
1041 (o->pixels_checked_out > 0)) return;
1042 if (o->engine_data)
1043 o->engine_data = ENFN->image_dirty_region(ENDT, o->engine_data, 0, 0, o->cur->image.w, o->cur->image.h);
1044 o->written = EINA_FALSE;
1045 evas_object_image_unload(eo_obj, 1);
1046 evas_object_inform_call_image_unloaded(eo_obj);
1047 evas_object_image_load(eo_obj, obj, o);
1048
1049 EINA_COW_WRITE_BEGIN(evas_object_image_state_cow, o->prev, Evas_Object_Image_State, prev_write)
1050 {
1051 prev_write->u.file = NULL;
1052 prev_write->key = NULL;
1053 }
1054 EINA_COW_WRITE_END(evas_object_image_state_cow, o->prev, prev_write);
1055
1056 o->changed = EINA_TRUE;
1057 evas_object_change(eo_obj, obj);
1058}
1059
1060EOLIAN static Eina_Bool 893EOLIAN static Eina_Bool
1061_evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file, const char *key, const char *flags) 894_evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file, const char *key, const char *flags)
1062{ 895{
@@ -1217,7 +1050,7 @@ _evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file
1217 else 1050 else
1218 { 1051 {
1219 old_data = im->image.data; 1052 old_data = im->image.data;
1220 im->image.data = evas_object_image_data_convert_internal(o, data, EVAS_COLORSPACE_ARGB8888); 1053 im->image.data = _evas_image_data_convert_internal(o, data, EVAS_COLORSPACE_ARGB8888);
1221 } 1054 }
1222 if (im->image.data) 1055 if (im->image.data)
1223 { 1056 {
@@ -1241,78 +1074,6 @@ _evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file
1241 return ok; 1074 return ok;
1242} 1075}
1243 1076
1244/* deprecated */
1245EAPI Eina_Bool
1246evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *pixels)
1247{
1248 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
1249 Evas_Image_Data *o;
1250
1251 if (!eo_isa(eo_obj, MY_CLASS))
1252 {
1253 CRI("Object is not an %s!", eo_class_name_get(MY_CLASS));
1254 return EINA_FALSE;
1255 }
1256
1257 evas_object_async_block(obj);
1258 o = eo_data_scope_get(eo_obj, MY_CLASS);
1259 _evas_image_cleanup(eo_obj, obj, o);
1260 if ((pixels->w != o->cur->image.w) || (pixels->h != o->cur->image.h)) return EINA_FALSE;
1261
1262 switch (pixels->format)
1263 {
1264#if 0
1265 case EVAS_PIXEL_FORMAT_ARGB32:
1266 {
1267 if (o->engine_data)
1268 {
1269 DATA32 *image_pixels = NULL;
1270
1271 o->engine_data =
1272 ENFN->image_data_get(ENDT,
1273 o->engine_data,
1274 1,
1275 &image_pixels,
1276 &o->load_error);
1277/* FIXME: need to actualyl support this */
1278/* memcpy(image_pixels, pixels->rows, o->cur->image.w * o->cur->image.h * 4);*/
1279 if (o->engine_data)
1280 o->engine_data =
1281 ENFN->image_data_put(ENDT, o->engine_data, image_pixels);
1282 if (o->engine_data)
1283 o->engine_data =
1284 ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
1285 o->changed = EINA_TRUE;
1286 evas_object_change(eo_obj, obj);
1287 }
1288 }
1289 break;
1290#endif
1291 case EVAS_PIXEL_FORMAT_YUV420P_601:
1292 {
1293 if (o->engine_data)
1294 {
1295 DATA32 *image_pixels = NULL;
1296
1297 o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error, NULL);
1298 if (image_pixels)
1299 evas_common_convert_yuv_422p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h);
1300 if (o->engine_data)
1301 o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, image_pixels);
1302 if (o->engine_data)
1303 o->engine_data = ENFN->image_alpha_set(ENDT, o->engine_data, o->cur->has_alpha);
1304 o->changed = EINA_TRUE;
1305 evas_object_change(eo_obj, obj);
1306 }
1307 }
1308 break;
1309 default:
1310 return EINA_FALSE;
1311 break;
1312 }
1313 return EINA_TRUE;
1314}
1315
1316EOLIAN static void 1077EOLIAN static void
1317_evas_image_pixels_get_callback_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Evas_Object_Image_Pixels_Get_Cb func, void *data) 1078_evas_image_pixels_get_callback_set(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, Evas_Object_Image_Pixels_Get_Cb func, void *data)
1318{ 1079{
@@ -1355,9 +1116,9 @@ _evas_image_efl_image_load_load_dpi_set(Eo *eo_obj, Evas_Image_Data *o, double d
1355 1116
1356 if (o->cur->u.file) 1117 if (o->cur->u.file)
1357 { 1118 {
1358 evas_object_image_unload(eo_obj, 0); 1119 _evas_image_unload(eo_obj, obj, 0);
1359 evas_object_inform_call_image_unloaded(eo_obj); 1120 evas_object_inform_call_image_unloaded(eo_obj);
1360 evas_object_image_load(eo_obj, obj, o); 1121 _evas_image_load(eo_obj, obj, o);
1361 o->changed = EINA_TRUE; 1122 o->changed = EINA_TRUE;
1362 evas_object_change(eo_obj, obj); 1123 evas_object_change(eo_obj, obj);
1363 } 1124 }
@@ -1384,9 +1145,9 @@ _evas_image_efl_image_load_load_size_set(Eo *eo_obj, Evas_Image_Data *o, int w,
1384 1145
1385 if (o->cur->u.file) 1146 if (o->cur->u.file)
1386 { 1147 {
1387 evas_object_image_unload(eo_obj, 0); 1148 _evas_image_unload(eo_obj, obj, 0);
1388 evas_object_inform_call_image_unloaded(eo_obj); 1149 evas_object_inform_call_image_unloaded(eo_obj);
1389 evas_object_image_load(eo_obj, obj, o); 1150 _evas_image_load(eo_obj, obj, o);
1390 o->changed = EINA_TRUE; 1151 o->changed = EINA_TRUE;
1391 evas_object_change(eo_obj, obj); 1152 evas_object_change(eo_obj, obj);
1392 } 1153 }
@@ -1412,9 +1173,9 @@ _evas_image_efl_image_load_load_scale_down_set(Eo *eo_obj, Evas_Image_Data *o, i
1412 1173
1413 if (o->cur->u.file) 1174 if (o->cur->u.file)
1414 { 1175 {
1415 evas_object_image_unload(eo_obj, 0); 1176 _evas_image_unload(eo_obj, obj, 0);
1416 evas_object_inform_call_image_unloaded(eo_obj); 1177 evas_object_inform_call_image_unloaded(eo_obj);
1417 evas_object_image_load(eo_obj, obj, o); 1178 _evas_image_load(eo_obj, obj, o);
1418 o->changed = EINA_TRUE; 1179 o->changed = EINA_TRUE;
1419 evas_object_change(eo_obj, obj); 1180 evas_object_change(eo_obj, obj);
1420 } 1181 }
@@ -1444,9 +1205,9 @@ _evas_image_efl_image_load_load_region_set(Eo *eo_obj, Evas_Image_Data *o, int x
1444 1205
1445 if (o->cur->u.file) 1206 if (o->cur->u.file)
1446 { 1207 {
1447 evas_object_image_unload(eo_obj, 0); 1208 _evas_image_unload(eo_obj, obj, 0);
1448 evas_object_inform_call_image_unloaded(eo_obj); 1209 evas_object_inform_call_image_unloaded(eo_obj);
1449 evas_object_image_load(eo_obj, obj, o); 1210 _evas_image_load(eo_obj, obj, o);
1450 o->changed = EINA_TRUE; 1211 o->changed = EINA_TRUE;
1451 evas_object_change(eo_obj, obj); 1212 evas_object_change(eo_obj, obj);
1452 } 1213 }
@@ -1479,128 +1240,12 @@ _evas_image_efl_image_load_load_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Ima
1479 return o->load_opts->orientation;; 1240 return o->load_opts->orientation;;
1480} 1241}
1481 1242
1482/* FIXME: This should be deprecated and a legacy binding for pixel_set should be added */
1483EAPI void
1484evas_object_image_colorspace_set(Evas_Object *eo_obj, Evas_Colorspace cspace)
1485{
1486 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
1487 Evas_Image_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
1488 evas_object_async_block(obj);
1489
1490 _evas_image_cleanup(eo_obj, obj, o);
1491
1492 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
1493 state_write->cspace = cspace;
1494 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
1495
1496 if (o->engine_data)
1497 ENFN->image_colorspace_set(ENDT, o->engine_data, cspace);
1498}
1499
1500EOLIAN static Efl_Gfx_Colorspace 1243EOLIAN static Efl_Gfx_Colorspace
1501_evas_image_efl_gfx_buffer_colorspace_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) 1244_evas_image_efl_gfx_buffer_colorspace_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
1502{ 1245{
1503 return (Efl_Gfx_Colorspace) o->cur->cspace; 1246 return (Efl_Gfx_Colorspace) o->cur->cspace;
1504} 1247}
1505 1248
1506EAPI void
1507evas_object_image_video_surface_set(Evas_Object *eo_obj, Evas_Video_Surface *surf)
1508{
1509 EVAS_OBJECT_LEGACY_API(eo_obj);
1510
1511 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
1512 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
1513 evas_object_async_block(obj);
1514
1515 _evas_image_cleanup(eo_obj, obj, o);
1516 if (o->video_surface)
1517 {
1518 o->video_surface = EINA_FALSE;
1519 obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, eo_obj);
1520 }
1521
1522 if (surf)
1523 {
1524 if (surf->version != EVAS_VIDEO_SURFACE_VERSION) return;
1525
1526 if (!surf->update_pixels ||
1527 !surf->move ||
1528 !surf->resize ||
1529 !surf->hide ||
1530 !surf->show)
1531 return;
1532
1533 o->created = EINA_TRUE;
1534 o->video_surface = EINA_TRUE;
1535
1536 EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
1537 pixi_write->video = *surf;
1538 EINA_COW_PIXEL_WRITE_END(o, pixi_write)
1539
1540 obj->layer->evas->video_objects = eina_list_append(obj->layer->evas->video_objects, eo_obj);
1541 }
1542 else
1543 {
1544 if (!o->video_surface &&
1545 !o->pixels->video.update_pixels &&
1546 !o->pixels->video.move &&
1547 !o->pixels->video.resize &&
1548 !o->pixels->video.hide &&
1549 !o->pixels->video.show &&
1550 !o->pixels->video.data)
1551 return;
1552
1553 o->video_surface = EINA_FALSE;
1554 EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
1555 {
1556 pixi_write->video.update_pixels = NULL;
1557 pixi_write->video.move = NULL;
1558 pixi_write->video.resize = NULL;
1559 pixi_write->video.hide = NULL;
1560 pixi_write->video.show = NULL;
1561 pixi_write->video.data = NULL;
1562 }
1563 EINA_COW_PIXEL_WRITE_END(o, pixi_write)
1564 }
1565}
1566
1567EAPI const Evas_Video_Surface*
1568evas_object_image_video_surface_get(const Evas_Object *eo_obj)
1569{
1570 EVAS_OBJECT_LEGACY_API(eo_obj, NULL);
1571
1572 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
1573 return (!o->video_surface ? NULL : &o->pixels->video);
1574}
1575
1576EAPI void
1577evas_object_image_video_surface_caps_set(Evas_Object *eo_obj, unsigned int caps)
1578{
1579 EVAS_OBJECT_LEGACY_API(eo_obj);
1580
1581 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
1582 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
1583 evas_object_async_block(obj);
1584
1585 _evas_image_cleanup(eo_obj, obj, o);
1586
1587 if (caps == o->pixels->video_caps)
1588 return;
1589
1590 EINA_COW_PIXEL_WRITE_BEGIN(o, pixi_write)
1591 pixi_write->video_caps = caps;
1592 EINA_COW_PIXEL_WRITE_END(o, pixi_write)
1593}
1594
1595EAPI unsigned int
1596evas_object_image_video_surface_caps_get(const Evas_Object *eo_obj)
1597{
1598 EVAS_OBJECT_LEGACY_API(eo_obj, 0);
1599
1600 Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
1601 return (!o->video_surface ? 0 : o->pixels->video_caps);
1602}
1603
1604static void 1249static void
1605_on_image_native_surface_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *einfo EINA_UNUSED) 1250_on_image_native_surface_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *einfo EINA_UNUSED)
1606{ 1251{
@@ -1629,13 +1274,6 @@ _evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf)
1629 return (o->engine_data != NULL); 1274 return (o->engine_data != NULL);
1630} 1275}
1631 1276
1632EAPI void
1633evas_object_image_native_surface_set(Evas_Object *eo_obj, Evas_Native_Surface *surf)
1634{
1635 EVAS_OBJECT_LEGACY_API(eo_obj);
1636 _evas_image_native_surface_set(eo_obj, surf);
1637}
1638
1639Evas_Native_Surface * 1277Evas_Native_Surface *
1640_evas_image_native_surface_get(const Evas_Object *eo_obj) 1278_evas_image_native_surface_get(const Evas_Object *eo_obj)
1641{ 1279{
@@ -1649,13 +1287,6 @@ _evas_image_native_surface_get(const Evas_Object *eo_obj)
1649 return surf; 1287 return surf;
1650} 1288}
1651 1289
1652EAPI Evas_Native_Surface *
1653evas_object_image_native_surface_get(const Evas_Object *eo_obj)
1654{
1655 EVAS_OBJECT_LEGACY_API(eo_obj, NULL);
1656 return _evas_image_native_surface_get(eo_obj);
1657}
1658
1659EOLIAN static void 1290EOLIAN static void
1660_evas_image_efl_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Image_Scale_Hint hint) 1291_evas_image_efl_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Image_Scale_Hint hint)
1661{ 1292{
@@ -1875,7 +1506,7 @@ _evas_canvas_image_cache_reload(Eo *eo_e, Evas_Public_Data *e)
1875 { 1506 {
1876 if (eo_isa(obj->object, MY_CLASS)) 1507 if (eo_isa(obj->object, MY_CLASS))
1877 { 1508 {
1878 evas_object_image_unload(obj->object, 1); 1509 _evas_image_unload(obj->object, obj, 1);
1879 evas_object_inform_call_image_unloaded(obj->object); 1510 evas_object_inform_call_image_unloaded(obj->object);
1880 } 1511 }
1881 } 1512 }
@@ -1890,7 +1521,7 @@ _evas_canvas_image_cache_reload(Eo *eo_e, Evas_Public_Data *e)
1890 if (eo_isa(obj->object, MY_CLASS)) 1521 if (eo_isa(obj->object, MY_CLASS))
1891 { 1522 {
1892 Evas_Image_Data *o = eo_data_scope_get(obj->object, MY_CLASS); 1523 Evas_Image_Data *o = eo_data_scope_get(obj->object, MY_CLASS);
1893 evas_object_image_load(obj->object, obj, o); 1524 _evas_image_load(obj->object, obj, o);
1894 o->changed = EINA_TRUE; 1525 o->changed = EINA_TRUE;
1895 evas_object_change(obj->object, obj); 1526 evas_object_change(obj->object, obj);
1896 } 1527 }
@@ -1928,8 +1559,8 @@ _evas_canvas_image_max_size_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int *
1928 return EINA_TRUE; 1559 return EINA_TRUE;
1929} 1560}
1930 1561
1931static void 1562void
1932evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty) 1563_evas_image_unload(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool dirty)
1933{ 1564{
1934 Evas_Image_Data *o; 1565 Evas_Image_Data *o;
1935 Eina_Bool resize_call = EINA_FALSE; 1566 Eina_Bool resize_call = EINA_FALSE;
@@ -1938,7 +1569,6 @@ evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty)
1938 if ((!o->cur->u.file) || 1569 if ((!o->cur->u.file) ||
1939 (o->pixels_checked_out > 0)) return; 1570 (o->pixels_checked_out > 0)) return;
1940 1571
1941 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
1942 evas_object_async_block(obj); 1572 evas_object_async_block(obj);
1943 if (dirty) 1573 if (dirty)
1944 { 1574 {
@@ -1972,8 +1602,8 @@ evas_object_image_unload(Evas_Object *eo_obj, Eina_Bool dirty)
1972 if (resize_call) evas_object_inform_call_image_resize(eo_obj); 1602 if (resize_call) evas_object_inform_call_image_resize(eo_obj);
1973} 1603}
1974 1604
1975static void 1605void
1976evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o) 1606_evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o)
1977{ 1607{
1978 Evas_Image_Load_Opts lo; 1608 Evas_Image_Load_Opts lo;
1979 1609
@@ -1998,19 +1628,9 @@ evas_object_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Eva
1998 lo.orientation = o->load_opts->orientation; 1628 lo.orientation = o->load_opts->orientation;
1999 lo.degree = 0; 1629 lo.degree = 0;
2000 if (o->cur->mmaped_source) 1630 if (o->cur->mmaped_source)
2001 o->engine_data = ENFN->image_mmap 1631 o->engine_data = ENFN->image_mmap(ENDT, o->cur->u.f, o->cur->key, &o->load_error, &lo);
2002 (ENDT,
2003 o->cur->u.f,
2004 o->cur->key,
2005 &o->load_error,
2006 &lo);
2007 else 1632 else
2008 o->engine_data = ENFN->image_load 1633 o->engine_data = ENFN->image_load(ENDT, o->cur->u.file, o->cur->key, &o->load_error, &lo);
2009 (ENDT,
2010 o->cur->u.file,
2011 o->cur->key,
2012 &o->load_error,
2013 &lo);
2014 1634
2015 if (o->engine_data) 1635 if (o->engine_data)
2016 { 1636 {
@@ -2112,7 +1732,7 @@ _evas_object_image_free(Evas_Object *obj)
2112{ 1732{
2113 Evas_Image_Data *o; 1733 Evas_Image_Data *o;
2114 1734
2115 if (!eo_isa(obj, MY_CLASS)) return; 1735 EINA_SAFETY_ON_FALSE_RETURN(eo_isa(obj, EVAS_IMAGE_CLASS));
2116 1736
2117 o = eo_data_scope_get(obj, MY_CLASS); 1737 o = eo_data_scope_get(obj, MY_CLASS);
2118 1738
@@ -3806,8 +3426,8 @@ evas_object_image_can_map(Evas_Object *obj EINA_UNUSED)
3806 return 1; 3426 return 1;
3807} 3427}
3808 3428
3809static void * 3429void *
3810evas_object_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace) 3430_evas_image_data_convert_internal(Evas_Image_Data *o, void *data, Evas_Colorspace to_cspace)
3811{ 3431{
3812 void *out = NULL; 3432 void *out = NULL;
3813 3433
@@ -4115,8 +3735,6 @@ _evas_image_efl_gfx_buffer_buffer_copy_set(Eo *obj, Evas_Image_Data *o, const vo
4115 return _evas_image_buffer_set_common(obj, o, (void *) pixels, width, height, stride, cspace, EINA_TRUE); 3735 return _evas_image_buffer_set_common(obj, o, (void *) pixels, width, height, stride, cspace, EINA_TRUE);
4116} 3736}
4117 3737
4118/* Legacy deprecated functions */
4119
4120EAPI void 3738EAPI void
4121evas_object_image_data_set(Eo *eo_obj, void *data) 3739evas_object_image_data_set(Eo *eo_obj, void *data)
4122{ 3740{
@@ -4295,465 +3913,6 @@ evas_object_image_data_copy_set(Eo *eo_obj, void *data)
4295 EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o); 3913 EVAS_OBJECT_WRITE_IMAGE_FREE_FILE_AND_KEY(o);
4296} 3914}
4297 3915
4298/* Legacy wrappers */
4299
4300EAPI Evas_Object *
4301evas_object_image_add(Evas *eo_e)
4302{
4303 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
4304 return eo_add(EVAS_IMAGE_CLASS, eo_e, efl_gfx_fill_filled_set(eo_self, EINA_FALSE), evas_obj_legacy_ctor(eo_self));
4305}
4306
4307EAPI Evas_Object *
4308evas_object_image_filled_add(Evas *eo_e)
4309{
4310 EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
4311 return eo_add(EVAS_IMAGE_CLASS, eo_e, evas_obj_legacy_ctor(eo_self));
4312}
4313
4314EAPI void
4315evas_object_image_fill_set(Evas_Image *obj,
4316 Evas_Coord x, Evas_Coord y,
4317 Evas_Coord w, Evas_Coord h)
4318{
4319 efl_gfx_fill_set((Evas_Image *)obj, x, y, w, h);
4320}
4321
4322EAPI void
4323evas_object_image_preload(Evas_Object *eo_obj, Eina_Bool cancel)
4324{
4325 if (cancel)
4326 efl_image_load_async_cancel(eo_obj);
4327 else
4328 efl_image_load_async_start(eo_obj);
4329}
4330
4331EAPI Eina_Bool
4332evas_object_image_filled_get(const Evas_Object *eo_obj)
4333{
4334 return efl_gfx_fill_filled_get(eo_obj);
4335}
4336
4337EAPI void
4338evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value)
4339{
4340 efl_gfx_fill_filled_set(eo_obj, value);
4341}
4342
4343EAPI void
4344evas_object_image_fill_get(const Evas_Image *obj,
4345 Evas_Coord *x, Evas_Coord *y,
4346 Evas_Coord *w, Evas_Coord *h)
4347{
4348 efl_gfx_fill_get(obj, x, y, w, h);
4349}
4350
4351EAPI void
4352evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread spread)
4353{
4354 /* not implemented! */
4355 if (spread != EFL_GFX_FILL_REPEAT)
4356 WRN("Fill spread support is not implemented!");
4357}
4358
4359EAPI Evas_Fill_Spread
4360evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED)
4361{
4362 return EFL_GFX_FILL_REPEAT;
4363}
4364
4365EAPI void
4366evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha)
4367{
4368 EVAS_OBJECT_LEGACY_API(obj);
4369 efl_gfx_buffer_alpha_set(obj, alpha);
4370}
4371
4372EAPI Eina_Bool
4373evas_object_image_alpha_get(const Evas_Object *obj)
4374{
4375 EVAS_OBJECT_LEGACY_API(obj, EINA_FALSE);
4376 return efl_gfx_buffer_alpha_get(obj);
4377}
4378
4379EAPI void
4380evas_object_image_border_set(Evas_Object *obj, int l, int r, int t, int b)
4381{
4382 efl_image_border_set(obj, l, r, t, b);
4383}
4384
4385EAPI void
4386evas_object_image_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b)
4387{
4388 efl_image_border_get(obj, l, r, t, b);
4389}
4390
4391EAPI void
4392evas_object_image_border_scale_set(Evas_Object *obj, double scale)
4393{
4394 efl_image_border_scale_set(obj, scale);
4395}
4396
4397EAPI double
4398evas_object_image_border_scale_get(const Evas_Object *obj)
4399{
4400 return efl_image_border_scale_get(obj);
4401}
4402
4403EAPI void
4404evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Border_Fill_Mode fill)
4405{
4406 efl_image_border_center_fill_set(obj, (Efl_Gfx_Border_Fill_Mode) fill);
4407}
4408
4409EAPI Evas_Border_Fill_Mode
4410evas_object_image_border_center_fill_get(const Evas_Object *obj)
4411{
4412 return (Evas_Border_Fill_Mode) efl_image_border_center_fill_get(obj);
4413}
4414
4415EAPI void
4416evas_object_image_size_get(const Evas_Image *obj, int *w, int *h)
4417{
4418 efl_gfx_view_size_get(obj, w, h);
4419}
4420
4421EAPI Evas_Colorspace
4422evas_object_image_colorspace_get(const Evas_Object *obj)
4423{
4424 return (Evas_Colorspace) efl_gfx_buffer_colorspace_get(obj);
4425}
4426
4427EAPI int
4428evas_object_image_stride_get(const Evas_Object *obj)
4429{
4430 return efl_gfx_buffer_stride_get(obj);
4431}
4432
4433EAPI void
4434evas_object_image_data_update_add(Evas_Object *obj, int x, int y, int w, int h)
4435{
4436 efl_gfx_buffer_update_add(obj, x, y, w, h);
4437}
4438
4439EAPI void
4440evas_object_image_file_set(Eo *obj, const char *file, const char *key)
4441{
4442 efl_file_set(obj, file, key);
4443}
4444
4445EAPI void
4446evas_object_image_file_get(const Eo *obj, const char **file, const char **key)
4447{
4448 efl_file_get(obj, file, key);
4449}
4450
4451EAPI void
4452evas_object_image_mmap_set(Evas_Image *obj, const Eina_File *f, const char *key)
4453{
4454 efl_file_mmap_set(obj, f, key);
4455}
4456
4457EAPI void
4458evas_object_image_mmap_get(const Evas_Image *obj, const Eina_File **f, const char **key)
4459{
4460 efl_file_mmap_get(obj, f, key);
4461}
4462
4463EAPI Eina_Bool
4464evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags)
4465{
4466 return efl_file_save(obj, file, key, flags);
4467}
4468
4469EAPI Eina_Bool
4470evas_object_image_animated_get(const Eo *obj)
4471{
4472 return efl_image_animated_get(obj);
4473}
4474
4475EAPI void
4476evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index)
4477{
4478 efl_image_animated_frame_set(obj, frame_index);
4479}
4480
4481EAPI int
4482evas_object_image_animated_frame_count_get(const Evas_Object *obj)
4483{
4484 return efl_image_animated_frame_count_get(obj);
4485}
4486
4487EAPI Evas_Image_Animated_Loop_Hint
4488evas_object_image_animated_loop_type_get(const Evas_Object *obj)
4489{
4490 return (Evas_Image_Animated_Loop_Hint) efl_image_animated_loop_type_get(obj);
4491}
4492
4493EAPI int
4494evas_object_image_animated_loop_count_get(const Evas_Object *obj)
4495{
4496 return efl_image_animated_loop_count_get(obj);
4497}
4498
4499EAPI double
4500evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int frame_num)
4501{
4502 return efl_image_animated_frame_duration_get(obj, start_frame, frame_num);
4503}
4504
4505EAPI void
4506evas_object_image_load_size_set(Eo *obj, int w, int h)
4507{
4508 efl_image_load_size_set(obj, w, h);
4509}
4510
4511EAPI void
4512evas_object_image_load_size_get(const Eo *obj, int *w, int *h)
4513{
4514 efl_image_load_size_get(obj, w, h);
4515}
4516
4517EAPI void
4518evas_object_image_load_dpi_set(Evas_Object *obj, double dpi)
4519{
4520 efl_image_load_dpi_set(obj, dpi);
4521}
4522
4523EAPI double
4524evas_object_image_load_dpi_get(const Evas_Object *obj)
4525{
4526 return efl_image_load_dpi_get(obj);
4527}
4528
4529EAPI void
4530evas_object_image_load_region_set(Evas_Object *obj, int x, int y, int w, int h)
4531{
4532 efl_image_load_region_set(obj, x, y, w, h);
4533}
4534
4535EAPI void
4536evas_object_image_load_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
4537{
4538 efl_image_load_region_get(obj, x, y, w, h);
4539}
4540
4541EAPI Eina_Bool
4542evas_object_image_region_support_get(const Evas_Image *obj)
4543{
4544 return efl_image_load_region_support_get(obj);
4545}
4546
4547EAPI void
4548evas_object_image_load_orientation_set(Evas_Object *obj, Eina_Bool enable)
4549{
4550 efl_image_load_orientation_set(obj, enable);
4551}
4552
4553EAPI Eina_Bool
4554evas_object_image_load_orientation_get(const Evas_Object *obj)
4555{
4556 return efl_image_load_orientation_get(obj);
4557}
4558
4559EAPI void
4560evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down)
4561{
4562 efl_image_load_scale_down_set(obj, scale_down);
4563}
4564
4565EAPI int
4566evas_object_image_load_scale_down_get(const Evas_Object *obj)
4567{
4568 return efl_image_load_scale_down_get(obj);
4569}
4570
4571EAPI Evas_Load_Error
4572evas_object_image_load_error_get(const Evas_Object *obj)
4573{
4574 return (Evas_Load_Error) efl_image_load_error_get(obj);
4575}
4576
4577EAPI void
4578evas_object_image_smooth_scale_set(Eo *obj, Eina_Bool smooth_scale)
4579{
4580 efl_image_smooth_scale_set(obj, smooth_scale);
4581}
4582
4583EAPI Eina_Bool
4584evas_object_image_smooth_scale_get(const Eo *obj)
4585{
4586 return efl_image_smooth_scale_get(obj);
4587}
4588
4589EAPI void
4590evas_object_image_orient_set(Evas_Image *obj, Evas_Image_Orient orient)
4591{
4592 efl_image_orientation_set(obj, (Efl_Gfx_Orientation) orient);
4593}
4594
4595EAPI Evas_Image_Orient
4596evas_object_image_orient_get(const Evas_Image *obj)
4597{
4598 return (Evas_Image_Orient) efl_image_orientation_get(obj);
4599}
4600
4601EAPI void
4602evas_object_image_snapshot_set(Evas_Object *eo, Eina_Bool s)
4603{
4604 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
4605
4606 EVAS_OBJECT_LEGACY_API(eo);
4607 if (obj->cur->snapshot == s) return;
4608
4609 EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
4610 state_write->snapshot = !!s;
4611 EINA_COW_STATE_WRITE_END(obj, state_write, cur);
4612}
4613
4614EAPI Eina_Bool
4615evas_object_image_snapshot_get(const Evas_Object *eo)
4616{
4617 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
4618 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
4619 return obj->cur->snapshot;
4620}
4621
4622EAPI Eina_Bool
4623evas_object_image_source_set(Evas_Object *eo, Evas_Object *src)
4624{
4625 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
4626 return _evas_image_proxy_source_set(eo, src);
4627}
4628
4629EAPI Evas_Object *
4630evas_object_image_source_get(const Evas_Object *eo)
4631{
4632 EVAS_OBJECT_LEGACY_API(eo, NULL);
4633 return _evas_image_proxy_source_get(eo);
4634}
4635
4636EAPI Eina_Bool
4637evas_object_image_source_unset(Evas_Object *eo_obj)
4638{
4639 EVAS_OBJECT_LEGACY_API(eo_obj, EINA_FALSE);
4640 return _evas_image_proxy_source_set(eo_obj, NULL);
4641}
4642
4643EAPI void
4644evas_object_image_source_clip_set(Evas_Object *eo, Eina_Bool source_clip)
4645{
4646 EVAS_OBJECT_LEGACY_API(eo);
4647 _evas_image_proxy_source_clip_set(eo, source_clip);
4648}
4649
4650EAPI Eina_Bool
4651evas_object_image_source_clip_get(const Evas_Object *eo)
4652{
4653 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
4654 return _evas_image_proxy_source_clip_get(eo);
4655}
4656
4657EAPI void
4658evas_object_image_source_events_set(Evas_Object *eo, Eina_Bool repeat)
4659{
4660 EVAS_OBJECT_LEGACY_API(eo);
4661 _evas_image_proxy_source_events_set(eo, repeat);
4662}
4663
4664EAPI Eina_Bool
4665evas_object_image_source_events_get(const Evas_Object *eo)
4666{
4667 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
4668 return _evas_image_proxy_source_events_get(eo);
4669}
4670
4671EAPI void
4672evas_object_image_content_hint_set(Evas_Object *obj, Evas_Image_Content_Hint hint)
4673{
4674 return efl_image_content_hint_set(obj, hint);
4675}
4676
4677EAPI Evas_Image_Content_Hint
4678evas_object_image_content_hint_get(const Evas_Object *obj)
4679{
4680 return efl_image_content_hint_get(obj);
4681}
4682
4683EAPI void
4684evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint)
4685{
4686 return efl_image_scale_hint_set(obj, (Efl_Image_Scale_Hint) hint);
4687}
4688
4689EAPI Evas_Image_Scale_Hint
4690evas_object_image_scale_hint_get(const Evas_Object *obj)
4691{
4692 return (Evas_Image_Scale_Hint) efl_image_scale_hint_get(obj);
4693}
4694
4695EAPI void
4696evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible)
4697{
4698 /* FIXME: I'd love to remove this feature and replace by no_render.
4699 * But they are not 100% equivalent: if all proxies are removed, then the
4700 * source becomes visible again. This has some advantages for some apps but
4701 * it's complete hell to handle in evas render side.
4702 * -- jpeg, 2016/03/07
4703 */
4704
4705 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJECT_CLASS);
4706 Evas_Object_Protected_Data *src_obj;
4707 Evas_Image_Data *o;
4708
4709 EVAS_OBJECT_LEGACY_API(eo);
4710
4711 o = eo_data_scope_get(eo, MY_CLASS);
4712 if (!o->cur->source) return;
4713
4714 visible = !!visible;
4715 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
4716 if (src_obj->proxy->src_invisible == !visible) return;
4717
4718 evas_object_async_block(obj);
4719 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src_obj->proxy, Evas_Object_Proxy_Data, proxy_write)
4720 proxy_write->src_invisible = !visible;
4721 EINA_COW_WRITE_END(evas_object_proxy_cow, src_obj->proxy, proxy_write);
4722
4723 src_obj->changed_src_visible = EINA_TRUE;
4724 evas_object_smart_member_cache_invalidate(o->cur->source, EINA_FALSE,
4725 EINA_FALSE, EINA_TRUE);
4726 evas_object_change(o->cur->source, src_obj);
4727 if ((!visible) || (!src_obj->proxy->src_events)) return;
4728 //FIXME: Feed mouse events here.
4729}
4730
4731EAPI Eina_Bool
4732evas_object_image_source_visible_get(const Evas_Object *eo)
4733{
4734 /* FIXME: see evas_object_image_source_visible_set */
4735
4736 Evas_Object_Protected_Data *src_obj;
4737 Evas_Image_Data *o;
4738 Eina_Bool visible;
4739
4740 EVAS_OBJECT_LEGACY_API(eo, EINA_FALSE);
4741
4742 o = eo_data_scope_get(eo, MY_CLASS);
4743 if (!o->cur->source) visible = EINA_FALSE;
4744 src_obj = eo_data_scope_get(o->cur->source, EVAS_OBJECT_CLASS);
4745 if (src_obj) visible = !src_obj->proxy->src_invisible;
4746 else visible = EINA_FALSE;
4747
4748 return visible;
4749}
4750
4751EAPI void
4752evas_object_image_alpha_mask_set(Evas_Object *eo_obj EINA_UNUSED, Eina_Bool ismask EINA_UNUSED)
4753{
4754 DBG("This function is not implemented, has never been and never will be.");
4755}
4756
4757#include "canvas/evas_image.eo.c" 3916#include "canvas/evas_image.eo.c"
4758 3917
4759/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ 3918/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/