From a395f5ded565f3578a138b061106884dee7d5e18 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 3 Apr 2015 16:23:26 +0200 Subject: [PATCH] efl: add Efl.Gfx.View and use it in Evas.Image. --- src/Makefile_Efl.am | 1 + src/Makefile_Efl_Cxx.am | 1 + src/lib/efl/Efl.h | 1 + src/lib/efl/interfaces/efl_gfx_view.eo | 27 ++++++++++++++++++++ src/lib/efl/interfaces/efl_interfaces_main.c | 2 ++ src/lib/evas/Evas_Legacy.h | 26 +++++++++++++++++++ src/lib/evas/canvas/evas_image.eo | 26 +++---------------- src/lib/evas/canvas/evas_object_image.c | 18 +++++++++++-- 8 files changed, 77 insertions(+), 25 deletions(-) create mode 100644 src/lib/efl/interfaces/efl_gfx_view.eo diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index 4791e0d2d4..15429a241c 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -8,6 +8,7 @@ efl_eolian_files = \ lib/efl/interfaces/efl_gfx_base.eo \ lib/efl/interfaces/efl_gfx_stack.eo \ lib/efl/interfaces/efl_gfx_fill.eo \ + lib/efl/interfaces/efl_gfx_view.eo \ lib/efl/interfaces/efl_gfx_shape.eo \ lib/efl/interfaces/efl_gfx_gradient.eo \ lib/efl/interfaces/efl_gfx_gradient_linear.eo \ diff --git a/src/Makefile_Efl_Cxx.am b/src/Makefile_Efl_Cxx.am index 9fdbdfc32c..e2ed95a636 100644 --- a/src/Makefile_Efl_Cxx.am +++ b/src/Makefile_Efl_Cxx.am @@ -12,6 +12,7 @@ generated_efl_cxx_bindings = \ lib/efl/interfaces/efl_gfx_base.eo.hh \ lib/efl/interfaces/efl_gfx_stack.eo.hh \ lib/efl/interfaces/efl_gfx_fill.eo.hh \ + lib/efl/interfaces/efl_gfx_view.eo.hh \ lib/efl/interfaces/efl_gfx_shape.eo.hh \ lib/efl/interfaces/efl_gfx_gradient.eo.hh \ lib/efl/interfaces/efl_gfx_gradient_linear.eo.hh \ diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index 4fb67f378d..9b0dea2960 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -140,6 +140,7 @@ typedef enum _Efl_Gfx_Fill_Spread #include "interfaces/efl_gfx_base.eo.h" #include "interfaces/efl_gfx_stack.eo.h" #include "interfaces/efl_gfx_fill.eo.h" +#include "interfaces/efl_gfx_view.eo.h" #include "interfaces/efl_gfx_shape.eo.h" #include "interfaces/efl_gfx_gradient.eo.h" #include "interfaces/efl_gfx_gradient_linear.eo.h" diff --git a/src/lib/efl/interfaces/efl_gfx_view.eo b/src/lib/efl/interfaces/efl_gfx_view.eo new file mode 100644 index 0000000000..9d609d5cdb --- /dev/null +++ b/src/lib/efl/interfaces/efl_gfx_view.eo @@ -0,0 +1,27 @@ +interface Efl.Gfx.View { + legacy_prefix: null; + properties { + size { + set { + /*@ + Sets the size of the given image object. + + This function will scale down or crop the image so that it is + treated as if it were at the given size. If the size given is + smaller than the image, it will be cropped. If the size given is + larger, then the image will be treated as if it were in the upper + left hand corner of a larger image that is otherwise transparent. */ + } + get { + /*@ + Retrieves the size of the given image object. + + See @ref evas_object_image_size_set() for more details. */ + } + values { + int w; /*@ The new width of the image. */ + int h; /*@ The new height of the image. */ + } + } + } +} diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 938b161866..d53bef8df9 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -14,6 +14,8 @@ #include "interfaces/efl_gfx_base.eo.c" #include "interfaces/efl_gfx_stack.eo.c" #include "interfaces/efl_gfx_fill.eo.c" +#include "interfaces/efl_gfx_view.eo.c" + #include "interfaces/efl_gfx_shape.eo.c" #include "interfaces/efl_gfx_gradient.eo.c" #include "interfaces/efl_gfx_gradient_linear.eo.c" diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index a8b1c9f758..3258613124 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -2066,6 +2066,32 @@ image) to start drawing from. */ EAPI void evas_object_image_fill_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +/** + * + * Sets the size of the given image object. + * + * This function will scale down or crop the image so that it is + * treated as if it were at the given size. If the size given is + * smaller than the image, it will be cropped. If the size given is + * larger, then the image will be treated as if it were in the upper + * left hand corner of a larger image that is otherwise transparent. + * + * @param[in] w The new width of the image. + * @param[in] h The new height of the image. + */ +EAPI void evas_object_image_size_set(Evas_Object *obj, int w, int h); + +/** + * + * Retrieves the size of the given image object. + * + * See @ref evas_object_image_size_set() for more details. + * + * @param[out] w The new width of the image. + * @param[out] h The new height of the image. + */ +EAPI void evas_object_image_size_get(const Evas_Object *obj, int *w, int *h); + #include "canvas/evas_image.eo.legacy.h" /** diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index 7e44576319..e6783b1400 100644 --- a/src/lib/evas/canvas/evas_image.eo +++ b/src/lib/evas/canvas/evas_image.eo @@ -1,4 +1,4 @@ -class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill) +class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View) { legacy_prefix: evas_object_image; eo_prefix: evas_obj_image; @@ -393,28 +393,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill) #Evas_Border_Fill_Mode). */ } } - size { - set { - /*@ - Sets the size of the given image object. - - This function will scale down or crop the image so that it is - treated as if it were at the given size. If the size given is - smaller than the image, it will be cropped. If the size given is - larger, then the image will be treated as if it were in the upper - left hand corner of a larger image that is otherwise transparent. */ - } - get { - /*@ - Retrieves the size of the given image object. - - See @ref evas_object_image_size_set() for more details. */ - } - values { - int w; /*@ The new width of the image. */ - int h; /*@ The new height of the image. */ - } - } source_visible { set { /*@ @@ -1010,5 +988,7 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill) Efl.Gfx.Fill.fill_spread.get; Efl.Gfx.Fill.fill.set; Efl.Gfx.Fill.fill.get; + Efl.Gfx.View.size.set; + Efl.Gfx.View.size.get; } } diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 54fb8f647d..ebd3292c99 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -1073,8 +1073,14 @@ _evas_image_efl_gfx_fill_fill_spread_get(Eo *eo_obj EINA_UNUSED, return (Evas_Fill_Spread)o->cur->spread;; } +EAPI void +evas_object_image_size_set(Evas_Image *obj, int w, int h) +{ + eo_do((Evas_Image *)obj, efl_gfx_view_size_set(w, h)); +} + EOLIAN static void -_evas_image_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h) +_evas_image_efl_gfx_view_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); @@ -1137,8 +1143,16 @@ _evas_image_size_set(Eo *eo_obj, Evas_Image_Data *o, int w, int h) evas_object_change(eo_obj, obj); } +EAPI void +evas_object_image_size_get(const Evas_Image *obj, int *w, int *h) +{ + eo_do((Evas_Image *)obj, efl_gfx_view_size_get(w, h)); +} + EOLIAN static void -_evas_image_size_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o, int *w, int *h) +_evas_image_efl_gfx_view_size_get(Eo *eo_obj EINA_UNUSED, + Evas_Image_Data *o, + int *w, int *h) { if (w) *w = o->cur->image.w; if (h) *h = o->cur->image.h;