From 161b7b93e2f5587ce2daab7eca05c2beb5d5e9d5 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 3 Apr 2015 16:13:07 +0200 Subject: [PATCH] evas: add Evas_VG_Image. --- src/Makefile_Evas.am | 6 ++- src/lib/evas/Evas_Eo.h | 1 + src/lib/evas/canvas/evas_vg_image.c | 63 ++++++++++++++++++++++++++++ src/lib/evas/canvas/evas_vg_image.eo | 32 ++++++++++++++ 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 src/lib/evas/canvas/evas_vg_image.c create mode 100644 src/lib/evas/canvas/evas_vg_image.eo diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index ba1f525764..32425870c0 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -39,7 +39,8 @@ evas_eolian_files = \ lib/evas/canvas/evas_vg_root_node.eo \ lib/evas/canvas/evas_vg_gradient.eo \ lib/evas/canvas/evas_vg_gradient_radial.eo \ - lib/evas/canvas/evas_vg_gradient_linear.eo + lib/evas/canvas/evas_vg_gradient_linear.eo \ + lib/evas/canvas/evas_vg_image.eo evas_eolian_c = $(evas_eolian_files:%.eo=%.eo.c) evas_eolian_h = $(evas_eolian_files:%.eo=%.eo.h) \ @@ -219,7 +220,8 @@ lib/evas/canvas/evas_vg_root_node.c \ lib/evas/canvas/evas_vg_gradient.c \ lib/evas/canvas/evas_vg_gradient_linear.c \ lib/evas/canvas/evas_vg_gradient_radial.c \ -lib/evas/canvas/evas_vg_utils.c +lib/evas/canvas/evas_vg_utils.c \ +lib/evas/canvas/evas_vg_image.c # Engine lib_evas_libevas_la_SOURCES += \ diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index cfadf6d331..846c8f6819 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -931,3 +931,4 @@ typedef enum _Evas_VG_Gradient_Spread #include "canvas/evas_vg_gradient.eo.h" #include "canvas/evas_vg_gradient_linear.eo.h" #include "canvas/evas_vg_gradient_radial.eo.h" +#include "canvas/evas_vg_image.eo.h" diff --git a/src/lib/evas/canvas/evas_vg_image.c b/src/lib/evas/canvas/evas_vg_image.c new file mode 100644 index 0000000000..b93fc13f9e --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_image.c @@ -0,0 +1,63 @@ +#include "evas_common_private.h" +#include "evas_private.h" + +#include + +typedef struct _Evas_VG_Image_Data Evas_VG_Image_Data; +struct _Evas_VG_Image_Data +{ + // FIXME: only manipulate Eina_File internally. + Eina_Stringshare *file, *key; + + int x, y; + unsigned int w, h; +}; + +void +_evas_vg_image_position_set(Eo *obj, Evas_VG_Image_Data *pd, int x, int y) +{ + pd->x = x; + pd->y = y; +} + +void +_evas_vg_image_position_get(Eo *obj, Evas_VG_Image_Data *pd, int *x, int *y) +{ + if (x) *x = pd->x; + if (y) *y = pd->y; +} + +void +_evas_vg_image_size_set(Eo *obj, Evas_VG_Image_Data *pd, + unsigned int w, unsigned int h) +{ + pd->w = w; + pd->h = h; +} + +void +_evas_vg_image_size_get(Eo *obj, Evas_VG_Image_Data *pd, + unsigned int *w, unsigned int *h) +{ + if (w) *w = pd->w; + if (h) *h = pd->h; +} + +Eina_Bool +_evas_vg_image_efl_file_file_set(Eo *obj, Evas_VG_Image_Data *pd, + const char *file, const char *key) +{ + eina_stringshare_replace(&pd->file, file); + eina_stringshare_replace(&pd->key, key); +} + +void +_evas_vg_image_efl_file_file_get(Eo *obj, Evas_VG_Image_Data *pd, + const char **file, const char **key) +{ + if (file) *file = pd->file; + if (key) *key = pd->key; +} + + +#include "evas_vg_image.eo.c" diff --git a/src/lib/evas/canvas/evas_vg_image.eo b/src/lib/evas/canvas/evas_vg_image.eo new file mode 100644 index 0000000000..6ed670e93e --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_image.eo @@ -0,0 +1,32 @@ +class Evas.VG_Image (Evas.VG_Node, Efl.File) +{ + eo_prefix: evas_vg_image; + legacy_prefix: null; + properties { + position { + set { + } + get { + } + values { + int x; + int y; + } + } + size { + set { + } + get { + } + values { + uint w; + uint h; + } + } + // FIXME: add aspect ratio following SVG specification + } + implements { + Efl.File.file.set; + Efl.File.file.get; + } +} \ No newline at end of file