Efl.Image: Move alpha to Efl.Gfx.Buffer

The buffer class is more low-level and alpha is a pretty
common property. I still wonder how to share it with the canvas
and other things.

It doesn't belong to Efl.Gfx.Base since we could have plain old
buffers that are not evas objects (only in-memory buffers) but
Efl.Gfx.Base may also need the alpha flag.
This commit is contained in:
Jean-Philippe Andre 2016-03-11 16:13:13 +09:00
parent 97c9ced648
commit b239098441
4 changed files with 34 additions and 30 deletions

View File

@ -46,6 +46,30 @@ interface Efl.Gfx.Buffer ()
cspace: Efl.Gfx.Colorspace;
}
}
@property alpha {
[[Indicates whether the alpha channel should be used.
This does not indicate whether the image source file contains
an alpha channel, only whether to respect it or discard it.
]]
set {
[[Change alpha channel usage for this object.
This function sets a flag on an image object indicating
whether or not to use alpha channel data. A value of $true
makes it use alpha channel data, and $false makes it ignore
that data. Note that this has nothing to do with an object's
color as manipulated by @Efl.Gfx.Base.color.set.
]]
}
get {
[[Retrieve whether alpha channel data is used on this object.]]
}
values {
alpha: bool; [[Whether to use alpha channel ($true) data
or not ($false).]]
}
}
@property stride {
[[Length in bytes of one row of pixels in memory.

View File

@ -1,3 +1,5 @@
import efl_gfx_types;
enum Efl.Image.Content_Hint
{
[[How an image's data is to be treated by EFL, for optimization.]]
@ -37,30 +39,6 @@ interface Efl.Image ()
smooth_scale: bool; [[Whether to use smooth scale or not.]]
}
}
@property alpha {
[[Indicates whether the alpha channel should be used.
This does not indicate whether the image source file contains
an alpha channel, only whether to respect it or discard it.
]]
set {
[[Change alpha channel usage for this object.
This function sets a flag on an image object indicating
whether or not to use alpha channel data. A value of $true
makes it use alpha channel data, and $false makes it ignore
that data. Note that this has nothing to do with an object's
color as manipulated by @Efl.Gfx.Base.color.set.
]]
}
get {
[[Retrieve whether alpha channel data is used on this object.]]
}
values {
alpha: bool; [[Whether to use alpha channel ($true) data
or not ($false).]]
}
}
@property ratio {
[[The native width/height ratio of the image.]]
get {

View File

@ -53,8 +53,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An
Efl.File.save;
Efl.Image.orientation.get;
Efl.Image.orientation.set;
Efl.Image.alpha.get;
Efl.Image.alpha.set;
Efl.Image.smooth_scale.set;
Efl.Image.smooth_scale.get;
Efl.Image.ratio.get;
@ -89,6 +87,8 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An
Efl.Image_Load.load_region.get;
Efl.Image_Load.load_region.set;
Efl.Image_Load.load_region_support.get;
Efl.Gfx.Buffer.alpha.get;
Efl.Gfx.Buffer.alpha.set;
Efl.Gfx.Buffer.buffer_update_add;
Efl.Gfx.Buffer.stride.get;
Efl.Gfx.Buffer.colorspace.get;

View File

@ -936,7 +936,7 @@ _evas_image_efl_gfx_buffer_buffer_update_add(Eo *eo_obj, Evas_Image_Data *o, int
}
EOLIAN static void
_evas_image_efl_image_alpha_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool has_alpha)
_evas_image_efl_gfx_buffer_alpha_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool has_alpha)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
@ -982,7 +982,7 @@ _evas_image_efl_image_alpha_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool has_al
}
EOLIAN static Eina_Bool
_evas_image_efl_image_alpha_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
_evas_image_efl_gfx_buffer_alpha_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
{
return o->cur->has_alpha;
}
@ -4368,13 +4368,15 @@ evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED)
EAPI void
evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha)
{
efl_image_alpha_set(obj, alpha);
EVAS_OBJECT_LEGACY_API(obj);
efl_gfx_buffer_alpha_set(obj, alpha);
}
EAPI Eina_Bool
evas_object_image_alpha_get(const Evas_Object *obj)
{
return efl_image_alpha_get(obj);
EVAS_OBJECT_LEGACY_API(obj, EINA_FALSE);
return efl_gfx_buffer_alpha_get(obj);
}
EAPI void