aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary
diff options
context:
space:
mode:
authorHyoyoung Chang <hyoyoung@gmail.com>2012-01-06 05:50:33 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-01-06 05:50:33 +0000
commit781a6ab4db351d630ae4e618fe95946d41cbc488 (patch)
treec981b3c670750c4e64f96fc07eb4a0d1cc45d579 /legacy/elementary
parentElementary Test Index: Cast list item to object item (diff)
downloadefl-781a6ab4db351d630ae4e618fe95946d41cbc488.tar.gz
From: Hyoyoung Chang <hyoyoung@gmail.com>
Subject: [E-devel] [patch] elm_photo - add aspect_ratio_retained_{set/get} Date: Fri, 6 Jan 2012 12:20:33 +0900 Dear all. elm_photo doesn't have resizing functions which are not follow original photo file ratio (vertical/horizontal). so i copied aspect_ration_reatined functions from elm_image. also it fixes photo menu bug in elementary_test. currently photo window has a bug which cannot display non-square images correctly. Thanks SVN revision: 66924
Diffstat (limited to 'legacy/elementary')
-rw-r--r--legacy/elementary/src/bin/test_photo.c1
-rw-r--r--legacy/elementary/src/lib/elm_photo.c20
-rw-r--r--legacy/elementary/src/lib/elm_photo.h29
3 files changed, 50 insertions, 0 deletions
diff --git a/legacy/elementary/src/bin/test_photo.c b/legacy/elementary/src/bin/test_photo.c
index 43505100bf..a994b673dc 100644
--- a/legacy/elementary/src/bin/test_photo.c
+++ b/legacy/elementary/src/bin/test_photo.c
@@ -51,6 +51,7 @@ test_photo(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
elm_app_data_dir_get(), img[n]);
n++;
if (n >= 9) n = 0;
+ elm_photo_aspect_fixed_set(ph, EINA_FALSE);
elm_photo_size_set(ph, 80);
if (n == 8)
elm_photo_thumb_set(ph, buf, NULL);
diff --git a/legacy/elementary/src/lib/elm_photo.c b/legacy/elementary/src/lib/elm_photo.c
index 6955b9484d..a1e83bce3a 100644
--- a/legacy/elementary/src/lib/elm_photo.c
+++ b/legacy/elementary/src/lib/elm_photo.c
@@ -608,4 +608,24 @@ elm_photo_thumb_set(const Evas_Object *obj, const char *file, const char *group)
#endif
}
+EAPI void
+elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ return _els_smart_icon_aspect_ratio_retained_set(wd->img, fixed);
+}
+
+EAPI Eina_Bool
+elm_photo_aspect_fixed_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ return _els_smart_icon_aspect_ratio_retained_get(wd->img);
+}
+
+
+
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/
diff --git a/legacy/elementary/src/lib/elm_photo.h b/legacy/elementary/src/lib/elm_photo.h
index 515514d6b8..73be49c976 100644
--- a/legacy/elementary/src/lib/elm_photo.h
+++ b/legacy/elementary/src/lib/elm_photo.h
@@ -79,5 +79,34 @@ EAPI void elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill);
EAPI void elm_photo_editable_set(Evas_Object *obj, Eina_Bool set);
/**
+ * Set whether the original aspect ratio of the photo should be kept on resize.
+ *
+ * @param obj The photo object.
+ * @param fixed @c EINA_TRUE if the photo should fix the aspect,
+ * @c EINA_FALSE otherwise.
+ *
+ * The original aspect ratio (width / height) of the photo is usually
+ * distorted to match the object's size. Enabling this option will fix
+ * this original aspect, and the way that the photo is fit into
+ * the object's area
+ *
+ * @see elm_photo_aspect_fixed_get()
+ *
+ * @ingroup Photo
+ */
+EAPI void elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
+
+/**
+ * Get if the object fixes the original aspect ratio.
+ *
+ * @param obj The photo object.
+ * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE
+ * otherwise.
+ *
+ * @ingroup Photo
+ */
+EAPI Eina_Bool elm_photo_aspect_fixed_get(const Evas_Object *obj);
+
+/**
* @}
*/