eunue pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a5a44b0104c7302b9e3ca2925d28b3212206c714

commit a5a44b0104c7302b9e3ca2925d28b3212206c714
Author: Jaeun Choi <jaeun12.c...@samsung.com>
Date:   Fri Apr 29 11:50:59 2016 +0900

    Elm_Image: add and remove eo properties related to image scaling
    
    This patch adds scale_type and scalalable property
    and removes fill_inside and aspect_fixed property
---
 src/lib/elementary/elm_image.c        | 103 ++++++++++++++++++++++------------
 src/lib/elementary/elm_image.eo       |  59 +++++++++++--------
 src/lib/elementary/elm_image_legacy.h |  64 +++++++++++++++++++++
 3 files changed, 169 insertions(+), 57 deletions(-)

diff --git a/src/lib/elementary/elm_image.c b/src/lib/elementary/elm_image.c
index 48f70d9..263c80a 100644
--- a/src/lib/elementary/elm_image.c
+++ b/src/lib/elementary/elm_image.c
@@ -539,24 +539,6 @@ _elm_image_efl_image_smooth_scale_get(Eo *obj EINA_UNUSED, 
Elm_Image_Data *sd)
    return evas_object_image_smooth_scale_get(sd->img);
 }
 
-EOLIAN static void
-_elm_image_fill_inside_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool fill_inside)
-{
-   fill_inside = !!fill_inside;
-
-   if (sd->fill_inside == fill_inside) return;
-
-   sd->fill_inside = fill_inside;
-
-   _elm_image_internal_sizing_eval(obj, sd);
-}
-
-EOLIAN static Eina_Bool
-_elm_image_fill_inside_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
-{
-   return sd->fill_inside;
-}
-
 static Eina_Bool
 _elm_image_drag_n_drop_cb(void *elm_obj,
       Evas_Object *obj,
@@ -1286,23 +1268,6 @@ _elm_image_evas_draggable_interface_drag_target_get(Eo 
*obj EINA_UNUSED, Elm_Ima
    return sd->edit;
 }
 
-EOLIAN static void
-_elm_image_aspect_fixed_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool fixed)
-{
-   fixed = !!fixed;
-   if (sd->aspect_fixed == fixed) return;
-
-   sd->aspect_fixed = fixed;
-
-   _elm_image_internal_sizing_eval(obj, sd);
-}
-
-EOLIAN static Eina_Bool
-_elm_image_aspect_fixed_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
-{
-   return sd->aspect_fixed;
-}
-
 EAPI Eina_Bool
 elm_image_animated_available_get(const Evas_Object *obj)
 {
@@ -1444,6 +1409,31 @@ _elm_image_class_constructor(Eo_Class *klass)
    evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
 }
 
+EOLIAN static void
+_elm_image_scale_type_set(Eo *obj EINA_UNUSED, Elm_Image_Data *sd EINA_UNUSED, 
Elm_Image_Scale_Type type EINA_UNUSED)
+{
+   //TODO: implementation
+}
+
+EOLIAN static Elm_Image_Scale_Type
+_elm_image_scale_type_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd EINA_UNUSED)
+{
+   //TODO: implementation
+   return ELM_IMAGE_SCALE_TYPE_NONE;
+}
+
+EOLIAN static void
+_elm_image_scalable_set(Eo *obj EINA_UNUSED, Elm_Image_Data *sd EINA_UNUSED, 
Eina_Bool up EINA_UNUSED, Eina_Bool down EINA_UNUSED)
+{
+   //TODO: implementation
+}
+
+EOLIAN static void
+_elm_image_scalable_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd EINA_UNUSED, 
Eina_Bool *up EINA_UNUSED, Eina_Bool *down EINA_UNUSED)
+{
+   //TODO: implementation
+}
+
 // A11Y
 
 EOLIAN static void
@@ -1970,4 +1960,47 @@ elm_image_resizable_get(const Evas_Object *obj, 
Eina_Bool *size_up, Eina_Bool *s
    if (size_down) *size_down = sd->resize_down;
 }
 
+EAPI void
+elm_image_fill_inside_set(Evas_Object *obj, Eina_Bool fill_inside)
+{
+   ELM_IMAGE_CHECK(obj);
+   ELM_IMAGE_DATA_GET(obj, sd);
+   fill_inside = !!fill_inside;
+
+   if (sd->fill_inside == fill_inside) return;
+
+   sd->fill_inside = fill_inside;
+
+   _elm_image_internal_sizing_eval(obj, sd);
+}
+
+EAPI Eina_Bool
+elm_image_fill_inside_get(const Evas_Object *obj)
+{
+   ELM_IMAGE_CHECK(obj) EINA_FALSE;
+   ELM_IMAGE_DATA_GET(obj, sd);
+   return sd->fill_inside;
+}
+
+EAPI void
+elm_image_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
+{
+   ELM_IMAGE_CHECK(obj);
+   ELM_IMAGE_DATA_GET(obj, sd);
+   fixed = !!fixed;
+   if (sd->aspect_fixed == fixed) return;
+
+   sd->aspect_fixed = fixed;
+
+   _elm_image_internal_sizing_eval(obj, sd);
+}
+
+EAPI Eina_Bool
+elm_image_aspect_fixed_get(const Evas_Object *obj)
+{
+   ELM_IMAGE_CHECK(obj) EINA_FALSE;
+   ELM_IMAGE_DATA_GET(obj, sd);
+   return sd->aspect_fixed;
+}
+
 #include "elm_image.eo.c"
diff --git a/src/lib/elementary/elm_image.eo b/src/lib/elementary/elm_image.eo
index da71f2f..a1ef3f4 100644
--- a/src/lib/elementary/elm_image.eo
+++ b/src/lib/elementary/elm_image.eo
@@ -1,5 +1,26 @@
 import evas_image;
 
+enum Elm.Image.Scale_Type
+{
+   [[Enumeration that defines scale types for the object's internal image.
+
+     @since 1.18
+   ]]
+   none,       [[Not scale the internal image]]
+   fill,       [[Scale the internal image so that it matches the object's area 
exactly.
+                 The image's aspect ratio might be changed.]]
+   fit_inside, [[Scale the internal image
+                 so that it fits inside the object's area
+                 while maintaining the aspect ratio.
+                 At least one of the dimensions of the image
+                 should be equal to the corresponding dimension of the 
object.]]
+   fit_outside [[Scale the internal image
+                 so that it covers the entire object area
+                 while maintaining the aspect ratio.
+                 At least one of the dimensions of the image
+                 should be equal to the corresponding dimension of the 
object.]]
+}
+
 struct Elm.Image_Progress
 {
    [[
@@ -27,41 +48,35 @@ class Elm.Image (Elm.Widget, Evas.Clickable_Interface, 
Evas.Draggable_Interface,
 {
    eo_prefix: elm_obj_image;
    methods {
-      @property fill_inside {
-         [[Control the resize method for the object's internal image when 
maintaining a given aspect ratio.
+      @property scale_type {
+         [[Control how the internal image is scaled.
 
-           If $fill_inside is true, image does not overflow the widget and
-           blank spaces are added to fill the space that is still free. If it
-           is false, the image overflows the image will fill all space and
-           overflow in its larger dimension.
-
-           You can think of it as "fill: inside" or "fill: outside" and not as
-           "fill the inside".
-
-           @since 1.7]]
+           @since 1.18]]
          set {
-            legacy: null;
          }
          get {
-            legacy: null;
          }
          values {
-            fill_inside: bool; [[Resize method for the object's internal 
image.]]
+            scale_type: Elm.Image.Scale_Type;
          }
       }
-      @property aspect_fixed {
-         set {
-            [[Control whether the original aspect ratio of the image should be 
kept on resize.
+      @property scalable {
+         [[Enable or disable scaling up or down the internal image.
 
-              The original aspect ratio (width / height) of the image is 
usually
-              distorted to match the object's size. Enabling this option will 
retain
-              this original aspect, and the way that the image is fit into the 
object's
-              area depends on the option set by @.fill_inside.]]
+           @since 1.18]]
+         set {
          }
          get {
          }
          values {
-            fixed: bool; [[$true if the image should retain the aspect, $false 
otherwise.]]
+            scale_up: bool;   [[If $true, the internal image might be scaled up
+                                if necessary according to the scale type.
+                                if $false, the internal image is not scaled up
+                                no matter what the scale type is.]]
+            scale_down: bool; [[If $true, the internal image might be scaled 
down
+                                if necessary according to the scale type.
+                                if $false, the internal image is not scaled 
down
+                                no matter what the scale type is.]]
          }
                }
       @property icon {
diff --git a/src/lib/elementary/elm_image_legacy.h 
b/src/lib/elementary/elm_image_legacy.h
index 2d8b1d2..8bed5ca 100644
--- a/src/lib/elementary/elm_image_legacy.h
+++ b/src/lib/elementary/elm_image_legacy.h
@@ -565,4 +565,68 @@ EAPI void elm_image_no_scale_set(Evas_Object *obj, 
Eina_Bool no_scale);
  */
 EAPI Eina_Bool elm_image_no_scale_get(const Evas_Object *obj);
 
+/**
+ * @brief Control if the whole image is inside the object area
+ * when keeping the aspect ratio.
+ *
+ * If the image should keep its aspect ratio when the object is resized to 
another
+ * aspect ratio, there are two possibilities to scale the image: keep the 
entire
+ * image inside the limits of height and width of the object ($fill_inside is
+ * @c true) or let the extra width or height go outside of the object, and the
+ * image will fill the entire object ($fill_inside is @c false).
+ *
+ * @note This option will have no effect if @ref elm_image_aspect_fixed_get is
+ * set to @c false.
+ *
+ * See also @ref Elm.Image.fill_outside.
+ *
+ * @param[in] fill_inside @c true if the whole image is inside the object area,
+ * @c false otherwise. Default is @c true.
+ *
+ * @ingroup Elm_Image
+ */
+EAPI void elm_image_fill_inside_set(Evas_Object *obj, Eina_Bool fill_inside);
+
+/**
+ * @brief Get whether the whole image is inside the object area or not
+ * when keeping the aspect ratio.
+ *
+ * If the image should keep its aspect ratio when the object is resized to 
another
+ * aspect ratio, there are two possibilities to scale the image: keep the 
entire
+ * image inside the limits of height and width of the object ($fill_inside is
+ * @c true) or let the extra width or height go outside of the object, and the
+ * image will fill the entire object ($fill_inside is @c false).
+ *
+ * @note This option will have no effect if @ref elm_image_aspect_fixed_get is
+ * set to @c false.
+ *
+ * See also @ref Elm.Image.fill_outside.
+ *
+ * return @c true if the whole image is inside the object area,
+ * @c false otherwise. Default is @c true.
+ *
+ * @ingroup Elm_Image
+ */
+EAPI Eina_Bool elm_image_fill_inside_get(const Evas_Object *obj);
+
+/**
+ * @brief Control whether the internal image's aspect ratio
+ * is fixed to the original image's aspect ratio
+ *
+ * @param[in] fixed @ true if the aspect ratio is fixed
+ *
+ * @ingroup Elm_Image
+ */
+EAPI void elm_image_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
+
+/**
+ * @brief Get whether the internal image's aspect ratio
+ * is fixed to the original image's
+ *
+ * @return @ true if the aspect ratio is fixed
+ *
+ * @ingroup Elm_Image
+ */
+EAPI Eina_Bool elm_image_aspect_fixed_get(const Evas_Object *obj);
+
 #include "elm_image.eo.legacy.h"

-- 


Reply via email to