aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYeshwanth Reddivari <r.yeshwanth@samsung.com>2016-04-06 10:46:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-04-06 10:46:39 +0900
commit98edbd23a4cad4698187d309a4a608f481b41263 (patch)
treeacd5a5bc5c4dabadfbbb7092cfdb338caa25e10d /src
parentelm_layout: Attach object to iterator (diff)
downloadefl-98edbd23a4cad4698187d309a4a608f481b41263.tar.gz
Interface: Flip and orientation interface
Summary: Added flip and orientation interface and used them in evas_image. Removed efl_image_orientation_set API and used efl_orientation_set and efl_flip_set API. In implementation part, converted enums back and forth in order to keep current implementation as it is. Test Plan: src/examples/evas/evas-images5.c Reviewers: singh.amitesh, raster, tasn, herdsman, woohyun, cedric, felipealmeida, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3844
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Efl.am2
-rw-r--r--src/examples/evas/.gitignore1
-rw-r--r--src/examples/evas/Makefile.am6
-rw-r--r--src/examples/evas/Makefile.examples1
-rw-r--r--src/examples/evas/evas-images5.c200
-rw-r--r--src/lib/efl/Efl.h2
-rw-r--r--src/lib/efl/interfaces/efl_flip.eo32
-rw-r--r--src/lib/efl/interfaces/efl_gfx_types.eot15
-rw-r--r--src/lib/efl/interfaces/efl_image.eo15
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c2
-rw-r--r--src/lib/efl/interfaces/efl_orientation.eo41
-rw-r--r--src/lib/elementary/elm_image.c82
-rw-r--r--src/lib/elementary/elm_image.eo8
-rw-r--r--src/lib/elementary/elm_widget_image.h4
-rw-r--r--src/lib/evas/canvas/evas_image.eo9
-rw-r--r--src/lib/evas/canvas/evas_image_legacy.c9
-rw-r--r--src/lib/evas/canvas/evas_image_private.h3
-rw-r--r--src/lib/evas/canvas/evas_object_image.c77
18 files changed, 458 insertions, 51 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 17529a5c8a..6f8266547d 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -23,6 +23,8 @@ efl_eolian_files = \
lib/efl/interfaces/efl_gfx_filter.eo \
lib/efl/interfaces/efl_model_base.eo \
lib/efl/interfaces/efl_animator.eo \
+ lib/efl/interfaces/efl_orientation.eo \
+ lib/efl/interfaces/efl_flip.eo \
lib/efl/interfaces/efl_vpath.eo \
lib/efl/interfaces/efl_vpath_manager.eo \
lib/efl/interfaces/efl_vpath_file.eo \
diff --git a/src/examples/evas/.gitignore b/src/examples/evas/.gitignore
index c2f0585c97..3d07297bff 100644
--- a/src/examples/evas/.gitignore
+++ b/src/examples/evas/.gitignore
@@ -6,6 +6,7 @@
/evas_images2
/evas_images3
/evas_images4
+/evas_images5
/evas_init_shutdown
/evas_object_manipulation
/evas_object_manipulation-eo
diff --git a/src/examples/evas/Makefile.am b/src/examples/evas/Makefile.am
index 37eff33805..76a3d98fcc 100644
--- a/src/examples/evas/Makefile.am
+++ b/src/examples/evas/Makefile.am
@@ -154,6 +154,11 @@ evas_images4_SOURCES = evas-images4.c
evas_images4_LDADD = $(ECORE_EVAS_COMMON_LDADD)
evas_images4_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
+EXTRA_PROGRAMS += evas_images5
+evas_images5_SOURCES = evas-images5.c
+evas_images5_LDADD = $(ECORE_EVAS_COMMON_LDADD)
+evas_images5_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
+
EXTRA_PROGRAMS += evas_text
evas_text_SOURCES = evas-text.c
evas_text_LDADD = $(ECORE_EVAS_COMMON_LDADD)
@@ -347,6 +352,7 @@ evas-images.c \
evas-images2.c \
evas-images3.c \
evas-images4.c \
+evas-images5.c \
evas-init-shutdown.c \
evas-map-utils.c \
evas-map-aa.c \
diff --git a/src/examples/evas/Makefile.examples b/src/examples/evas/Makefile.examples
index 0d2b33a28b..66197f32fc 100644
--- a/src/examples/evas/Makefile.examples
+++ b/src/examples/evas/Makefile.examples
@@ -15,6 +15,7 @@ EXAMPLES= evas-aspect-hints \
evas-images2 \
evas-images3 \
evas-images4 \
+ evas-images5 \
evas-init-shutdown \
evas-map-utils \
evas-object-manipulation \
diff --git a/src/examples/evas/evas-images5.c b/src/examples/evas/evas-images5.c
new file mode 100644
index 0000000000..3dcd88d060
--- /dev/null
+++ b/src/examples/evas/evas-images5.c
@@ -0,0 +1,200 @@
+/**
+ * Simple Evas example illustrating some image objects functions
+ *
+ * You'll need at least one engine built for it (excluding the buffer
+ * one) and the png image loader/saver also built. See stdout/stderr
+ * for output.
+ *
+ * @verbatim
+ * gcc -o evas-images5 evas-images5.c `pkg-config --libs --cflags evas ecore ecore-evas efl`
+ * @endverbatim
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else
+#define PACKAGE_EXAMPLES_DIR "."
+#endif
+
+#define EFL_BETA_API_SUPPORT
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <stdio.h>
+#include <errno.h>
+#include <Efl.h>
+#include "evas-common.h"
+
+#define WIDTH (320)
+#define HEIGHT (240)
+
+static const char *img_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/im1.png";
+static const char *commands = \
+ "commands are:\n"
+ "\tp - print image fill property\n"
+ "\t0 - rotate by 0\n"
+ "\t1 - rotate by 90\n"
+ "\t2 - rotate by 180\n"
+ "\t3 - rotate by 270\n"
+ "\t4 - flip horizontal\n"
+ "\t5 - flip vertical\n"
+ "\t6 - flip none\n"
+ "\ts - save noise image to disk (/tmp dir)\n"
+ "\th - print help\n";
+
+const char *file_path = "/tmp/evas-images4-example.png";
+const char *quality_str = "quality=100";
+
+struct test_data
+{
+ Ecore_Evas *ee;
+ Evas *evas;
+ Evas_Object *bg, *img;
+};
+
+static struct test_data d = {0};
+
+static void
+_on_destroy(Ecore_Evas *ee EINA_UNUSED)
+{
+ ecore_main_loop_quit();
+}
+
+/* here just to keep our example's window size and background image's
+ * size in synchrony */
+static void
+_canvas_resize_cb(Ecore_Evas *ee)
+{
+ int w, h;
+
+ ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
+ evas_object_resize(d.bg, w, h);
+}
+
+static void
+_on_keydown(void *data EINA_UNUSED,
+ Evas *evas EINA_UNUSED,
+ Evas_Object *o EINA_UNUSED,
+ void *einfo)
+{
+ Evas_Event_Key_Down *ev = einfo;
+
+ if (strcmp(ev->key, "h") == 0) /* print help */
+ {
+ puts(commands);
+ return;
+ }
+
+ if (strcmp(ev->key, "s") == 0) /* save noise image to disk */
+ {
+ if (!evas_object_image_save(d.img, file_path, NULL, quality_str))
+ fprintf(stderr, "Cannot save image to '%s' (flags '%s')\n",
+ file_path, quality_str);
+ else
+ fprintf(stdout, "Image saved to '%s' (flags '%s'), check it out with "
+ "an image viewer\n", file_path, quality_str);
+
+ return;
+ }
+
+ if (strcmp(ev->key, "p") == 0) /* print image size*/
+ {
+ Evas_Coord w, h;
+
+ evas_object_image_size_get(d.img, &w, &h);
+ fprintf(stdout, "Image has size set to: w=%d, h=%d\n", w, h);
+ return;
+ }
+
+ int key_val = ev->key[0] - '0';
+
+ switch (key_val)
+ {
+ case 0:
+ efl_orientation_set(d.img, EFL_ORIENT_0);
+ break;
+ case 1:
+ efl_orientation_set(d.img, EFL_ORIENT_90);
+ break;
+ case 2:
+ efl_orientation_set(d.img, EFL_ORIENT_180);
+ break;
+ case 3:
+ efl_orientation_set(d.img, EFL_ORIENT_270);
+ break;
+ case 4:
+ efl_flip_set(d.img, EFL_FLIP_HORIZONTAL);
+ break;
+ case 5:
+ efl_flip_set(d.img, EFL_FLIP_VERTICAL);
+ break;
+ case 6:
+ efl_flip_set(d.img, EFL_FLIP_NONE);
+ break;
+ }
+}
+
+int
+main(void)
+{
+ int err;
+
+ if (!ecore_evas_init())
+ return EXIT_FAILURE;
+
+ /* this will give you a window with an Evas canvas under the first
+ * engine available */
+ d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL);
+ if (!d.ee)
+ goto error;
+
+ ecore_evas_callback_destroy_set(d.ee, _on_destroy);
+ ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb);
+ ecore_evas_show(d.ee);
+
+ /* the canvas pointer, de facto */
+ d.evas = ecore_evas_get(d.ee);
+
+ d.bg = evas_object_rectangle_add(d.evas);
+ evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */
+ evas_object_move(d.bg, 0, 0); /* at canvas' origin */
+ evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */
+ evas_object_show(d.bg);
+
+ d.img = evas_object_image_add(d.evas);
+ evas_object_image_file_set(d.img, img_path, NULL);
+ err = evas_object_image_load_error_get(d.img);
+ if (err != EVAS_LOAD_ERROR_NONE)
+ {
+ fprintf(stderr, "could not load image '%s'. error string is \"%s\"\n",
+ img_path, evas_load_error_str(err));
+ }
+ else
+ {
+ fprintf(stdout,
+ "loaded image '%s' with succes! error string is \"%s\"\n",
+ img_path, evas_load_error_str(err));
+
+ evas_object_move(d.img, WIDTH / 2, HEIGHT / 2);
+ evas_object_image_fill_set(d.img, 0, 0, WIDTH / 2, HEIGHT / 2);
+ evas_object_resize(d.img, WIDTH / 2, HEIGHT / 2);
+ evas_object_show(d.img);
+
+ evas_object_focus_set(d.bg, EINA_TRUE);
+ evas_object_event_callback_add(
+ d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL);
+ }
+
+ puts(commands);
+ ecore_main_loop_begin();
+
+ ecore_evas_free(d.ee);
+ ecore_evas_shutdown();
+ return 0;
+
+error:
+ fprintf(stderr, "you got to have at least one evas engine built and linked"
+ " up to ecore-evas for this example to run properly.\n");
+ ecore_evas_shutdown();
+ return -1;
+}
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 651a5bd3f2..2002ebc7e8 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -69,6 +69,8 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
#include "interfaces/efl_player.eo.h"
#include "interfaces/efl_text.eo.h"
#include "interfaces/efl_text_properties.eo.h"
+#include "interfaces/efl_orientation.eo.h"
+#include "interfaces/efl_flip.eo.h"
/* Core interface */
#include "interfaces/efl_animator.eo.h"
diff --git a/src/lib/efl/interfaces/efl_flip.eo b/src/lib/efl/interfaces/efl_flip.eo
new file mode 100644
index 0000000000..26d131971c
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_flip.eo
@@ -0,0 +1,32 @@
+enum Efl.Flip_Value
+{
+ [[Flip
+
+ See also @Efl.Flip
+ ]]
+ legacy: efl;
+ flip_none = 0, [[no flip]]
+ flip_horizontal = 1, [[flip image horizontally]]
+ flip_vertical = 2 [[flip image vertically]]
+}
+
+interface Efl.Flip
+{
+ legacy_prefix: null;
+ methods {
+ @property flip{
+ [[Control the flip of the given image
+
+ Use this function to change how your image is to be
+ flipped: vertically or horizontally or transpose
+ or traverse]]
+ set {
+ }
+ get {
+ }
+ values {
+ flip: Efl.Flip_Value; [[Flip]]
+ }
+ }
+ }
+}
diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot
index b1f3ab17e8..dedef830bd 100644
--- a/src/lib/efl/interfaces/efl_gfx_types.eot
+++ b/src/lib/efl/interfaces/efl_gfx_types.eot
@@ -159,18 +159,3 @@ enum Efl.Gfx.Border_Fill_Mode
solid = 2 [[Image's center region is to be made solid, even if it has transparency on it]]
}
-enum Efl.Gfx.Orientation
-{
- [[Orientation options for $Efl.Image.orientation
- @since 1.14]]
- /* FIXME: legacy: evas_image; */
- orient_none = 0, [[no orientation change]]
- orient_0 = 0, [[no orientation change]]
- orient_90 = 1, [[orient 90 degrees clockwise]]
- orient_180 = 2, [[orient 180 degrees clockwise]]
- orient_270 = 3, [[rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise)]]
- flip_horizontal = 4, [[flip image horizontally]]
- flip_vertical = 5, [[flip image vertically]]
- flip_transpose = 6, [[flip image along the y = (width - x) line (bottom-left to top-right)]]
- flip_transverse = 7 [[flip image along the y = x line (top-left to bottom-right)]]
-}
diff --git a/src/lib/efl/interfaces/efl_image.eo b/src/lib/efl/interfaces/efl_image.eo
index 50982a47e9..7e65faece3 100644
--- a/src/lib/efl/interfaces/efl_image.eo
+++ b/src/lib/efl/interfaces/efl_image.eo
@@ -48,21 +48,6 @@ interface Efl.Image ()
ratio: double; [[The image's ratio.]]
}
}
- @property orientation {
- [[The image orientation allows rotating and flipping the image
- at render time.
-
- Default is @Efl.Gfx.Orientation.orient_none
-
- @since 1.14
- ]]
- set {}
- get {}
- values {
- orient: Efl.Gfx.Orientation;
- }
- }
-
@property border {
[[Dimensions of this image's border, a region that does not scale
with the center area.
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index d01e8df265..908e2287df 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -35,3 +35,5 @@ EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
#include "interfaces/efl_model_base.eo.c"
#include "interfaces/efl_animator.eo.c"
+#include "interfaces/efl_orientation.eo.c"
+#include "interfaces/efl_flip.eo.c"
diff --git a/src/lib/efl/interfaces/efl_orientation.eo b/src/lib/efl/interfaces/efl_orientation.eo
new file mode 100644
index 0000000000..50781097b3
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_orientation.eo
@@ -0,0 +1,41 @@
+enum Efl.Orient
+{
+ [[Orientation
+
+ See also @Efl.Orientation
+ ]]
+ legacy: efl;
+ orient_none = 0,
+ orient_0 = 0, [[no orientation change]]
+ orient_90 = 90, [[orient 90 degrees clockwise]]
+ orient_180 = 180, [[orient 180 degrees clockwise]]
+ orient_270 = 270, [[rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise)]]
+ orient_up = 0, [[orient up]]
+ orient_right = 90, [[orient right]]
+ orient_down = 180, [[orient down]]
+ orient_left = 270, [[orient left]]
+ orient_vertical = 0, [[orient vertical]]
+ orient_horizontal = 90 [[orient horizontal]]
+
+}
+
+interface Efl.Orientation
+{
+ legacy_prefix: null;
+ methods {
+ @property orientation{
+ [[Control the orientation of a given widget
+
+ Use this function to change how your widget is to be
+ disposed: vertically or horizontally or inverted vertically
+ or inverted horizontally]]
+ set {
+ }
+ get {
+ }
+ values {
+ dir: Efl.Orient; [[Direction]]
+ }
+ }
+ }
+}
diff --git a/src/lib/elementary/elm_image.c b/src/lib/elementary/elm_image.c
index 44a29070fc..96f1fb2615 100644
--- a/src/lib/elementary/elm_image.c
+++ b/src/lib/elementary/elm_image.c
@@ -1229,22 +1229,42 @@ _elm_image_efl_image_load_load_size_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd,
}
EOLIAN static void
-_elm_image_efl_image_orientation_set(Eo *obj, Elm_Image_Data *sd, Efl_Gfx_Orientation orient)
+_elm_image_efl_orientation_orientation_set(Eo *obj, Elm_Image_Data *sd, Efl_Orient orient)
{
if (sd->edje) return;
if (sd->orient == orient) return;
- evas_object_image_orient_set(sd->img, (Evas_Image_Orient) orient);
+ efl_orientation_set(sd->img, orient);
+
sd->orient = orient;
_elm_image_internal_sizing_eval(obj, sd);
}
-EOLIAN static Efl_Gfx_Orientation
-_elm_image_efl_image_orientation_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
+EOLIAN static Efl_Orient
+_elm_image_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
{
return sd->orient;
}
+
+EOLIAN static void
+_elm_image_efl_flip_flip_set(Eo *obj, Elm_Image_Data *sd, Efl_Flip_Value flip)
+{
+ if (sd->edje) return;
+ if (sd->flip == flip) return;
+
+ efl_flip_set(sd->img, flip);
+
+ sd->flip = flip;
+ _elm_image_internal_sizing_eval(obj, sd);
+}
+
+EOLIAN static Efl_Flip_Value
+_elm_image_efl_flip_flip_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
+{
+ return sd->flip;
+}
+
/**
* Turns on editing through drag and drop and copy and paste.
*/
@@ -1633,13 +1653,63 @@ elm_image_preload_disabled_set(Evas_Object *obj, Eina_Bool disable)
EAPI void
elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient orient)
{
- efl_image_orientation_set(obj, (Efl_Gfx_Orientation) orient);
+ Efl_Orient dir;
+ Efl_Flip_Value flip;
+
+ ELM_IMAGE_DATA_GET(obj, sd);
+ sd->image_orient = orient;
+
+ switch (orient)
+ {
+ case EVAS_IMAGE_ORIENT_0:
+ dir = EFL_ORIENT_0;
+ flip = EFL_FLIP_NONE;
+ break;
+ case EVAS_IMAGE_ORIENT_90:
+ dir = EFL_ORIENT_90;
+ flip = EFL_FLIP_NONE;
+ break;
+ case EVAS_IMAGE_ORIENT_180:
+ dir = EFL_ORIENT_180;
+ flip = EFL_FLIP_NONE;
+ break;
+ case EVAS_IMAGE_ORIENT_270:
+ dir = EFL_ORIENT_270;
+ flip = EFL_FLIP_NONE;
+ break;
+ case EVAS_IMAGE_FLIP_HORIZONTAL:
+ dir = EFL_ORIENT_0;
+ flip = EFL_FLIP_HORIZONTAL;
+ break;
+ case EVAS_IMAGE_FLIP_VERTICAL:
+ dir = EFL_ORIENT_0;
+ flip = EFL_FLIP_VERTICAL;
+ break;
+ case EVAS_IMAGE_FLIP_TRANSVERSE:
+ dir = EFL_ORIENT_270;
+ flip = EFL_FLIP_HORIZONTAL;
+ break;
+ case EVAS_IMAGE_FLIP_TRANSPOSE:
+ dir = EFL_ORIENT_270;
+ flip = EFL_FLIP_VERTICAL;
+ break;
+ default:
+ dir = EFL_ORIENT_0;
+ flip = EFL_FLIP_NONE;
+ break;
+ }
+
+ efl_orientation_set(obj, dir);
+ efl_flip_set(obj, flip);
}
EAPI Elm_Image_Orient
elm_image_orient_get(const Evas_Object *obj)
{
- return (Elm_Image_Orient) efl_image_orientation_get(obj);
+ ELM_IMAGE_CHECK(obj) EVAS_IMAGE_ORIENT_NONE;
+ ELM_IMAGE_DATA_GET(obj, sd);
+
+ return sd->image_orient;
}
EAPI Evas_Object*
diff --git a/src/lib/elementary/elm_image.eo b/src/lib/elementary/elm_image.eo
index d963352441..1784e229bf 100644
--- a/src/lib/elementary/elm_image.eo
+++ b/src/lib/elementary/elm_image.eo
@@ -23,7 +23,7 @@ struct Elm.Image.Error
class Elm.Image (Elm.Widget, Evas.Clickable_Interface, Evas.Draggable_Interface,
Efl.File, Efl.Image, Efl.Image_Load, Efl.Player, Efl.Gfx.View, Efl.Player,
Elm.Interface_Atspi_Image, Elm.Interface_Atspi_Widget_Action,
- Edje.Object)
+ Edje.Object, Efl.Orientation, Efl.Flip)
{
eo_prefix: elm_obj_image;
methods {
@@ -115,8 +115,10 @@ class Elm.Image (Elm.Widget, Evas.Clickable_Interface, Evas.Draggable_Interface,
Efl.Image_Load.load_size.get;
Efl.Image.smooth_scale.set;
Efl.Image.smooth_scale.get;
- Efl.Image.orientation.set;
- Efl.Image.orientation.get;
+ Efl.Orientation.orientation.set;
+ Efl.Orientation.orientation.get;
+ Efl.Flip.flip.set;
+ Efl.Flip.flip.get;
Efl.Player.playable.get;
Efl.Player.play.set;
Efl.Player.play.get;
diff --git a/src/lib/elementary/elm_widget_image.h b/src/lib/elementary/elm_widget_image.h
index 1439824e2c..808138f98a 100644
--- a/src/lib/elementary/elm_widget_image.h
+++ b/src/lib/elementary/elm_widget_image.h
@@ -61,7 +61,9 @@ struct _Elm_Image_Data
int frame_count;
int cur_frame;
- Efl_Gfx_Orientation orient;
+ Elm_Image_Orient image_orient; // to support EAPI
+ Efl_Orient orient;
+ Efl_Flip_Value flip;
struct {
Ecore_Thread *th;
diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo
index 529e90f1ef..283744c8f0 100644
--- a/src/lib/evas/canvas/evas_image.eo
+++ b/src/lib/evas/canvas/evas_image.eo
@@ -1,7 +1,8 @@
type @extern Evas_Object_Image_Pixels_Get_Cb: __undefined_type; /* FIXME: func pointers are not supported. */
class Evas.Image (Evas.Object, Evas.Filter,
- Efl.Image, Efl.Gfx.Buffer, Efl.Gfx.Fill, Efl.Gfx.View, Efl.File)
+ Efl.Image, Efl.Gfx.Buffer, Efl.Gfx.Fill, Efl.Gfx.View, Efl.File,
+ Efl.Orientation, Efl.Flip)
{
/* Legacy is implement inside Efl.Canvas.Image */
legacy_prefix: evas_object_image;
@@ -12,8 +13,10 @@ class Evas.Image (Evas.Object, Evas.Filter,
Eo.Base.dbg_info_get;
Eo.Base.finalize;
Efl.File.save;
- Efl.Image.orientation.get;
- Efl.Image.orientation.set;
+ Efl.Orientation.orientation.get;
+ Efl.Orientation.orientation.set;
+ Efl.Flip.flip.set;
+ Efl.Flip.flip.get;
Efl.Image.smooth_scale.set;
Efl.Image.smooth_scale.get;
Efl.Image.ratio.get;
diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c
index 02843de15e..897192ebd6 100644
--- a/src/lib/evas/canvas/evas_image_legacy.c
+++ b/src/lib/evas/canvas/evas_image_legacy.c
@@ -347,14 +347,19 @@ EAPI void
evas_object_image_orient_set(Evas_Object *obj, Evas_Image_Orient orient)
{
EVAS_IMAGE_API(obj);
- efl_image_orientation_set(obj, (Efl_Gfx_Orientation) orient);
+
+ Evas_Image_Data *o = eo_data_scope_get(obj, EVAS_IMAGE_CLASS);
+ _evas_image_orientation_set(obj, o, orient);
}
EAPI Evas_Image_Orient
evas_object_image_orient_get(const Evas_Object *obj)
{
EVAS_IMAGE_API(obj, EVAS_IMAGE_ORIENT_NONE);
- return (Evas_Image_Orient) efl_image_orientation_get(obj);
+
+ Evas_Image_Data *o = eo_data_scope_get(obj, EVAS_IMAGE_CLASS);
+
+ return o->cur->orient;
}
EAPI void
diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h
index 407537cf9b..98a3dfe5f9 100644
--- a/src/lib/evas/canvas/evas_image_private.h
+++ b/src/lib/evas/canvas/evas_image_private.h
@@ -114,6 +114,8 @@ struct _Evas_Image_Data
Efl_Image_Scale_Hint scale_hint;
Efl_Image_Content_Hint content_hint;
+ Efl_Flip_Value flip_value;
+ Efl_Orient orient_value;
Eina_Bool changed : 1;
Eina_Bool dirty_pixels : 1;
@@ -169,6 +171,7 @@ void _evas_image_load_region_get(const Eo *eo_obj, int *x, int *y, int *w, int *
void _evas_image_load_orientation_set(Eo *eo_obj, Eina_Bool enable);
Eina_Bool _evas_image_load_orientation_get(const Eo *eo_obj);
Eina_Bool _evas_image_load_region_support_get(const Eo *eo_obj);
+void _evas_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Orient orient);
/* Efl.Image.Animated */
Eina_Bool _evas_image_animated_get(const Eo *eo_obj);
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 04a6a79a74..a2746346bd 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -341,11 +341,10 @@ _evas_image_done_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Dat
evas_object_change(eo_obj, obj);
}
-EOLIAN static void
-_evas_image_efl_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Gfx_Orientation _orient)
+void
+_evas_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Orient orient)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
- Evas_Image_Orient orient = (Evas_Image_Orient) _orient;
int iw, ih;
if (o->cur->orient == orient) return;
@@ -391,10 +390,76 @@ _evas_image_efl_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Gfx_Or
evas_object_change(eo_obj, obj);
}
-EOLIAN static Efl_Gfx_Orientation
-_evas_image_efl_image_orientation_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
+static Evas_Image_Orient
+_get_image_orient_from_orient_flip(Efl_Orient orient, Efl_Flip_Value flip)
+{
+ switch (orient)
+ {
+ case EFL_ORIENT_0:
+ if (flip == EFL_FLIP_HORIZONTAL)
+ return EVAS_IMAGE_FLIP_HORIZONTAL;
+ else if (flip == EFL_FLIP_VERTICAL)
+ return EVAS_IMAGE_FLIP_VERTICAL;
+ else
+ return EVAS_IMAGE_ORIENT_0;
+ case EFL_ORIENT_90:
+ if (flip == EFL_FLIP_HORIZONTAL)
+ return EVAS_IMAGE_FLIP_TRANSPOSE;
+ else if (flip == EFL_FLIP_VERTICAL)
+ return EVAS_IMAGE_FLIP_TRANSVERSE;
+ else
+ return EVAS_IMAGE_ORIENT_90;
+ case EFL_ORIENT_180:
+ if (flip == EFL_FLIP_HORIZONTAL)
+ return EVAS_IMAGE_FLIP_VERTICAL;
+ else if (flip == EFL_FLIP_VERTICAL)
+ return EVAS_IMAGE_FLIP_HORIZONTAL;
+ else
+ return EVAS_IMAGE_ORIENT_180;
+ case EFL_ORIENT_270:
+ if (flip == EFL_FLIP_HORIZONTAL)
+ return EVAS_IMAGE_FLIP_TRANSVERSE;
+ else if (flip == EFL_FLIP_VERTICAL)
+ return EVAS_IMAGE_FLIP_TRANSPOSE;
+ else
+ return EVAS_IMAGE_ORIENT_270;
+ default:
+ return EVAS_IMAGE_ORIENT_NONE;
+ }
+}
+
+EOLIAN static void
+_evas_image_efl_orientation_orientation_set(Eo *obj, Evas_Image_Data *o, Efl_Orient dir)
+{
+ Evas_Image_Orient orient;
+
+ o->orient_value = dir;
+ orient = _get_image_orient_from_orient_flip(dir, o->flip_value);
+
+ _evas_image_orientation_set(obj, o, orient);
+}
+
+EOLIAN static Efl_Orient
+_evas_image_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Evas_Image_Data *o)
+{
+ return o->orient_value;
+}
+
+EOLIAN static void
+_evas_image_efl_flip_flip_set(Eo *obj, Evas_Image_Data *o, Efl_Flip_Value flip)
+{
+ Evas_Image_Orient orient;
+
+ o->flip_value = flip;
+ orient = _get_image_orient_from_orient_flip(o->orient_value, flip);
+
+ _evas_image_orientation_set(obj, o, orient);
+}
+
+EOLIAN static Efl_Flip_Value
+_evas_image_efl_flip_flip_get(Eo *obj EINA_UNUSED, Evas_Image_Data *o)
{
- return (Efl_Gfx_Orientation) o->cur->orient;
+ return o->flip_value;
}
EOLIAN static void