summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/efl/interfaces/efl_image.eo5
-rw-r--r--src/lib/evas/canvas/evas_image.eo1
-rw-r--r--src/lib/evas/canvas/evas_object_image.c7
3 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/efl/interfaces/efl_image.eo b/src/lib/efl/interfaces/efl_image.eo
index 3b0efbf411..2d5c01cc99 100644
--- a/src/lib/efl/interfaces/efl_image.eo
+++ b/src/lib/efl/interfaces/efl_image.eo
@@ -34,11 +34,12 @@ interface Efl.Image {
}
}
@property ratio {
+ [[The native width/height ratio of the image.]]
get {
- [[The native ration of the image object]]
+ [[Returns 1.0 if not applicable (eg. height = 0).]]
}
values {
- ratio: double; [[The image's ratio]]
+ ratio: double; [[The image's ratio.]]
}
}
}
diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo
index 323ae946d4..42cfc12652 100644
--- a/src/lib/evas/canvas/evas_image.eo
+++ b/src/lib/evas/canvas/evas_image.eo
@@ -662,6 +662,7 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Animated, Efl.Gfx.
Efl.Image.load_size.get;
Efl.Image.smooth_scale.set;
Efl.Image.smooth_scale.get;
+ Efl.Image.ratio.get;
Efl.Gfx.Fill.fill.set;
Efl.Gfx.Fill.fill.get;
Efl.Gfx.Fill.filled.get;
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 15f2b0c07f..60802326b1 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1534,6 +1534,13 @@ _evas_image_efl_image_smooth_scale_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *
return o->cur->smooth_scale;
}
+EOLIAN static double
+_evas_image_efl_image_ratio_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
+{
+ if (!o->cur->image.h) return 1.0;
+ return (double) o->cur->image.w / (double) o->cur->image.h;
+}
+
/* deprecated */
EAPI void
evas_object_image_reload(Eo *eo_obj)