jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=544ae716edc226ad252b54dfd4cd9d679d82554b
commit 544ae716edc226ad252b54dfd4cd9d679d82554b Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Wed Mar 2 16:38:57 2016 +0900 Efl.Image: Improve documentation a bit This interface needs to be extended and cleaned up... this will happen in the following patches. --- src/lib/efl/interfaces/efl_image.eo | 52 ++++++------ src/lib/evas/canvas/evas_object_image.c | 135 +++++++++++++++++--------------- 2 files changed, 97 insertions(+), 90 deletions(-) diff --git a/src/lib/efl/interfaces/efl_image.eo b/src/lib/efl/interfaces/efl_image.eo index 27be0cc..dd9162a 100644 --- a/src/lib/efl/interfaces/efl_image.eo +++ b/src/lib/efl/interfaces/efl_image.eo @@ -2,44 +2,46 @@ interface Efl.Image { legacy_prefix: null; methods { @property animated { + /* FIXME: Move to specific interface */ get { - [[Check if an image can be animated (have multiple frames)]] + [[Check if an image can be animated (has multiple frames). + + This will be $true for animated Gif files for instance but $false + for still images. + ]] } values { - is_animated: bool; [[If it's animated or not.]] + is_animated: bool; [[$true if the image is animated]] } } @property load_size { + [[The loading size of an image. + + The image will be loaded into memory as if it was the set size + instead of the original size. This can save a lot of memory, + and is important for scalable types like svg. + ]] set { - [[Set the loading size of an image. The image will be loaded into - memory as if it was the set size instead of the original size. - This can save a lot of memory, and is important for scalable - types like svg. - ]] - } - get { + [[Requests the canvas to load the image at the given size.]] } + get {} values { - w: int; [[The new width of the image's load size.]] - h: int; [[The new height of the image's load size.]] + w: int; [[Width of the image's load size.]] + h: int; [[Height of the image's load size.]] } } @property smooth_scale { - set { - [[Sets whether to use high-quality image scaling algorithm on the - given image. + [[Whether to use high-quality image scaling algorithm for this image. - When enabled, a higher quality image scaling algorithm is used - when scaling images to sizes other than the source image's - original one. This gives better results but is more - computationally expensive. - ]] - } - get { - [[Retrieves whether the given image is using high-quality - image scaling algorithm. - ]] - } + When enabled, a higher quality image scaling algorithm is used + when scaling images to sizes other than the source image's + original one. This gives better results but is more + computationally expensive. + + $true by default + ]] + set {} + get {} values { smooth_scale: bool; [[Whether to use smooth scale or not.]] } diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 7c663b3..9d674c2 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -247,8 +247,11 @@ static const Evas_Object_Image_State default_state = { EVAS_COLORSPACE_ARGB8888, EVAS_IMAGE_ORIENT_NONE, - // flags - EINA_TRUE, EINA_FALSE, EINA_FALSE, EINA_FALSE, EINA_FALSE + EINA_TRUE, // smooth + EINA_FALSE, // has_alpha + EINA_FALSE, // opaque_valid + EINA_FALSE, // opaque + EINA_FALSE // mmapped_source }; Eina_Cow *evas_object_image_load_opts_cow = NULL; @@ -381,21 +384,6 @@ _evas_image_eo_base_finalize(Eo *eo_obj, Evas_Image_Data *o) return eo_finalize(eo_super(eo_obj, MY_CLASS)); } -EAPI Evas_Object * -evas_object_image_add(Evas *eo_e) -{ - EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); - return eo_add(EVAS_IMAGE_CLASS, eo_e, - efl_gfx_fill_filled_set(eo_obj, EINA_FALSE)); -} - -EAPI Evas_Object * -evas_object_image_filled_add(Evas *eo_e) -{ - EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); - return eo_add(EVAS_IMAGE_CLASS, eo_e); -} - EAPI void evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *format EINA_UNUSED, char *key) { @@ -961,18 +949,6 @@ _evas_image_efl_gfx_fill_filled_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) return o->filled; } -EAPI void -evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value) -{ - efl_gfx_fill_filled_set(eo_obj, value); -} - -EAPI Eina_Bool -evas_object_image_filled_get(const Evas_Object *eo_obj) -{ - return efl_gfx_fill_filled_get(eo_obj); -} - EOLIAN static void _evas_image_border_scale_set(Eo *eo_obj, Evas_Image_Data *o, double scale) { @@ -1033,14 +1009,6 @@ _evas_image_efl_gfx_fill_fill_set(Eo *eo_obj, Evas_Image_Data *o, evas_object_change(eo_obj, obj); } -EAPI void -evas_object_image_fill_get(const Evas_Image *obj, - Evas_Coord *x, Evas_Coord *y, - Evas_Coord *w, Evas_Coord *h) -{ - efl_gfx_fill_get((Evas_Image *)obj, x, y, w, h); -} - EOLIAN static void _evas_image_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, int *x, int *y, int *w, int *h) @@ -1051,26 +1019,6 @@ _evas_image_efl_gfx_fill_fill_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, if (h) *h = o->cur->fill.h; } -EAPI void -evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread spread) -{ - /* not implemented! */ - if (spread != EFL_GFX_FILL_REPEAT) - WRN("Fill spread support is not implemented!"); -} - -EAPI Evas_Fill_Spread -evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED) -{ - return EFL_GFX_FILL_REPEAT; -} - -EAPI void -evas_object_image_size_set(Evas_Image *obj, int w, int h) -{ - efl_gfx_view_size_set((Evas_Image *)obj, w, h); -} - EOLIAN static void _evas_image_efl_gfx_view_view_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h) { @@ -3209,6 +3157,14 @@ _evas_image_evas_filter_filter_input_alpha(Eo *eo_obj EINA_UNUSED, Evas_Image_Da return EINA_FALSE; } +EOLIAN static void +_evas_image_efl_gfx_filter_filter_program_set(Eo *obj, Evas_Image_Data *pd EINA_UNUSED, + const char *code, const char *name) +{ + pd->has_filter = (code != NULL); + efl_gfx_filter_program_set(eo_super(obj, MY_CLASS), code, name); +} + EOLIAN static Eina_Bool _evas_image_evas_filter_filter_input_render(Eo *eo_obj, Evas_Image_Data *o, void *_filter, void *context, @@ -4900,6 +4856,63 @@ _evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj) return pd->engine_data; } +/* Legacy wrappers */ + +EAPI Evas_Object * +evas_object_image_add(Evas *eo_e) +{ + EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); + return eo_add(EVAS_IMAGE_CLASS, eo_e, + efl_gfx_fill_filled_set(eoid, EINA_FALSE)); +} + +EAPI Evas_Object * +evas_object_image_filled_add(Evas *eo_e) +{ + EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL); + return eo_add(EVAS_IMAGE_CLASS, eo_e); +} + +EAPI void +evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value) +{ + efl_gfx_fill_filled_set(eo_obj, value); +} + +EAPI Eina_Bool +evas_object_image_filled_get(const Evas_Object *eo_obj) +{ + return efl_gfx_fill_filled_get((Eo *) eo_obj); +} + +EAPI void +evas_object_image_fill_get(const Evas_Image *obj, + Evas_Coord *x, Evas_Coord *y, + Evas_Coord *w, Evas_Coord *h) +{ + efl_gfx_fill_get((Evas_Image *)obj, x, y, w, h); +} + +EAPI void +evas_object_image_fill_spread_set(Evas_Image *obj EINA_UNUSED, Evas_Fill_Spread spread) +{ + /* not implemented! */ + if (spread != EFL_GFX_FILL_REPEAT) + WRN("Fill spread support is not implemented!"); +} + +EAPI Evas_Fill_Spread +evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED) +{ + return EFL_GFX_FILL_REPEAT; +} + +EAPI void +evas_object_image_size_set(Evas_Image *obj, int w, int h) +{ + efl_gfx_view_size_set((Evas_Image *)obj, w, h); +} + EAPI void evas_object_image_file_set(Eo *obj, const char *file, const char *key) { @@ -4960,14 +4973,6 @@ evas_object_image_smooth_scale_get(const Eo *obj) return efl_image_smooth_scale_get((Eo *) obj); } -EOLIAN static void -_evas_image_efl_gfx_filter_filter_program_set(Eo *obj, Evas_Image_Data *pd EINA_UNUSED, - const char *code, const char *name) -{ - pd->has_filter = (code != NULL); - efl_gfx_filter_program_set(eo_super(obj, MY_CLASS), code, name); -} - #include "canvas/evas_image.eo.c" /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ --