interface Efl.Gfx.Fill {
legacy_prefix: null;
methods {
+ @property filled {
+ [[Binds the object's @.fill property to its actual geometry.
+
+ If $true, then every time the object is resized, it will
+ automatically trigger a call to @Efl.Gfx.Fill.fill.set
+ with the new size (and 0, 0 as source image's origin),
+ so the bound image will fill the whole object's area.
+
+ This property takes precedence over @.fill.
+
+ This flag is $true by default (used to be $false with the old APIs).
+ ]]
+ set {}
+ get {}
+ values {
+ filled: bool; [[$true to make the fill property follow
+ object size or $false otherwise.]]
+ }
+ }
@property fill {
- /* FIXME: bad defaults, bad doc */
[[Specifies how to tile an image to fill its rectangle geometry.
Note that if $w or $h are smaller than the dimensions of the object,
$w and $h need to be the exact width and height of the image object
itself, respectively.
- Warning: The default values for the fill parameters are $x = 0,
- $y = 0, $w = 0 and $h = 0. Thus, if you're not using the
- evas_object_image_filled_add() helper and want your image
- displayed, you'll have to set valid values with this function on
- your object.
-
- Note: evas_object_image_filled_set() is a helper function which
- will override the values set here automatically, for you, in a
- given way.
+ Note that this property has no effect if @.filled is $true.
]]
/* FIXME-doc
* See the following image to better understand the effects of this
EAPI void evas_object_image_fill_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
/**
+ * @brief Set whether the image object's fill property should track the
+ * object's size.
+ *
+ * If @c setting is @c true, then every @ref evas_object_resize will
+ * automatically trigger a call to @ref evas_object_image_fill_set with the
+ * that new size (and 0, 0 as source image's origin), so the bound image will
+ * fill the whole object's area.
+ *
+ * @param[in] filled @c true to make the fill property follow object size or
+ * @c false otherwise.
+ *
+ * @ingroup Evas_Image
+ */
+EAPI void evas_object_image_filled_set(Evas_Object *obj, Eina_Bool filled);
+
+/**
+ * @brief Retrieve whether the image object's fill property should track the
+ * object's size.
+ *
+ * Returns @c true if it is tracking, @c false if not (and @ref
+ * evas_object_fill_set must be called manually).
+ *
+ * @return @c true to make the fill property follow object size or @c false
+ * otherwise.
+ *
+ * @ingroup Evas_Image
+ */
+EAPI Eina_Bool evas_object_image_filled_get(const Evas_Object *obj);
+
+/**
*
* Sets the size of the given image object.
*
src: Evas.Object *; [[Source object to use for the proxy.]]
}
}
- @property filled {
- set {
- [[Set whether the image object's fill property should track the
- object's size.
-
- If $setting is $true, then every \@ref evas_object_resize will
- automatically trigger a call to \@ref evas_object_image_fill_set
- with the that new size (and 0, 0 as source image's origin),
- so the bound image will fill the whole object's area.
- ]]
- }
- get {
- [[Retrieve whether the image object's fill property should track
- the object's size.
-
- Returns $true if it is tracking, $false if not (and
- \@ref evas_object_fill_set must be called manually).
- ]]
- }
- values {
- filled: bool; [[$true to make the fill property follow
- object size or $false otherwise.]]
- }
- }
@property content_hint {
set {
[[Set the content hint setting of a given image object of the
in @Evas.Border_Fill_Mode. By center we mean the complementary
part of that defined by @.border.set. This one is very useful
for making frames and decorations. You would most probably
- also be using a filled image (as in @.filled.set) to use as
- a frame.
+ also be using a filled image (as in @Efl.Gfx.Fill.filled) to use
+ as a frame.
]]
}
get {
Eo.Base.constructor;
Eo.Base.destructor;
Eo.Base.dbg_info_get;
+ Eo.Base.finalize;
Efl.File.file.set;
Efl.File.file.get;
Efl.File.mmap.set;
Efl.Image.smooth_scale.get;
Efl.Gfx.Fill.fill.set;
Efl.Gfx.Fill.fill.get;
+ Efl.Gfx.Fill.filled.get;
+ Efl.Gfx.Fill.filled.set;
Efl.Gfx.View.size.set;
Efl.Gfx.View.size.get;
Efl.Gfx.Filter.filter_program.set;
Eina_Bool changed : 1;
Eina_Bool dirty_pixels : 1;
Eina_Bool filled : 1;
+ Eina_Bool filled_set : 1;
Eina_Bool proxyrendering : 1;
Eina_Bool preloading : 1;
Eina_Bool video_surface : 1;
return eo_obj;
}
+EOLIAN static Eo *
+_evas_image_eo_base_finalize(Eo *eo_obj, Evas_Image_Data *o)
+{
+ if (!o->filled_set)
+ efl_gfx_fill_filled_set(eo_obj, EINA_TRUE);
+ return eo_finalize(eo_super(eo_obj, MY_CLASS));
+}
+
EAPI Evas_Object *
evas_object_image_add(Evas *eo_e)
{
- MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
- return NULL;
- MAGIC_CHECK_END();
- Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e->engine.func, NULL);
- Evas_Object *eo_obj = eo_add(EVAS_IMAGE_CLASS, eo_e);
- return eo_obj;
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
+ return eo_add(EVAS_IMAGE_CLASS, eo_e,
+ efl_gfx_fill_filled_set(eo_obj, EINA_FALSE));
}
EAPI Evas_Object *
evas_object_image_filled_add(Evas *eo_e)
{
- Evas_Object *eo_obj;
- eo_obj = evas_object_image_add(eo_e);
- evas_object_image_filled_set(eo_obj, 1);
- return eo_obj;
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(eo_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
+ return eo_add(EVAS_IMAGE_CLASS, eo_e);
}
EAPI void
return o->cur->border.fill;
}
-static void
-_evas_image_filled_set(Eo *eo_obj, Evas_Image_Data* o, Eina_Bool setting)
+EOLIAN static void
+_evas_image_efl_gfx_fill_filled_set(Eo *eo_obj, Evas_Image_Data* o, Eina_Bool setting)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
setting = !!setting;
+ o->filled_set = 1;
if (o->filled == setting) return;
evas_object_async_block(obj);
}
EOLIAN static Eina_Bool
-_evas_image_filled_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
+_evas_image_efl_gfx_fill_filled_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
{
return o->filled;
}
+EAPI void
+evas_object_image_filled_set(Evas_Object *eo_obj, Eina_Bool value)
+{
+ efl_gfx_fill_filled_set(eo_obj, value);
+}
+
+EAPI Eina_Bool
+evas_object_image_filled_get(const Evas_Object *eo_obj)
+{
+ return efl_gfx_fill_filled_get(eo_obj);
+}
+
EOLIAN static void
_evas_image_border_scale_set(Eo *eo_obj, Evas_Image_Data *o, double scale)
{
EAPI Eina_Bool
evas_object_image_save(const Eo *obj, const char *file, const char *key, const char *flags)
{
- Eina_Bool ret;
return efl_file_save((Eo *) obj, file, key, flags);
}
EAPI Eina_Bool
evas_object_image_animated_get(const Eo *obj)
{
- Eina_Bool ret;
return efl_image_animated_get((Eo *) obj);
}
EAPI Eina_Bool
evas_object_image_smooth_scale_get(const Eo *obj)
{
- Eina_Bool ret;
return efl_image_smooth_scale_get((Eo *) obj);
}
}
END_TEST
+START_TEST(evas_object_image_defaults)
+{
+ Evas *e = _setup_evas();
+ Evas_Object *o;
+ int x, y, w, h, iw, ih;
+ Eina_Bool b;
+
+ /* test legacy defaults */
+ o = evas_object_image_add(e);
+ fail_if(evas_object_image_filled_get(o));
+ evas_object_image_fill_get(o, &x, &y, &w, &h);
+ fail_if(x || y || w || h);
+ eo_del(o);
+
+ o = evas_object_image_filled_add(e);
+ fail_if(!evas_object_image_filled_get(o));
+ eo_del(o);
+
+ /* test eo defaults */
+ eo_add(&o, EVAS_IMAGE_CLASS, e);
+ fail_if(!efl_gfx_fill_filled_get(o));
+ eo_del(o);
+
+ evas_free(e);
+ evas_shutdown();
+}
+END_TEST
+
void evas_test_image_object(TCase *tc)
{
+ tcase_add_test(tc, evas_object_image_defaults);
tcase_add_test(tc, evas_object_image_loader);
tcase_add_test(tc, evas_object_image_loader_orientation);
tcase_add_test(tc, evas_object_image_orient);