summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-03-11 16:13:13 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-03-15 11:11:59 +0900
commitb23909844160196b654c13fbd7c20320e359c508 (patch)
tree6ec4d6cfce53d75bfa1d92997e86d9679f96c495 /src
parent97c9ced648ec1e25f1e6b997652c6c235bab1c74 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/efl/interfaces/efl_gfx_buffer.eo24
-rw-r--r--src/lib/efl/interfaces/efl_image.eo26
-rw-r--r--src/lib/evas/canvas/evas_image.eo4
-rw-r--r--src/lib/evas/canvas/evas_object_image.c10
4 files changed, 34 insertions, 30 deletions
diff --git a/src/lib/efl/interfaces/efl_gfx_buffer.eo b/src/lib/efl/interfaces/efl_gfx_buffer.eo
index f176b6afa9..87de79b05d 100644
--- a/src/lib/efl/interfaces/efl_gfx_buffer.eo
+++ b/src/lib/efl/interfaces/efl_gfx_buffer.eo
@@ -46,6 +46,30 @@ interface Efl.Gfx.Buffer ()
46 cspace: Efl.Gfx.Colorspace; 46 cspace: Efl.Gfx.Colorspace;
47 } 47 }
48 } 48 }
49 @property alpha {
50 [[Indicates whether the alpha channel should be used.
51
52 This does not indicate whether the image source file contains
53 an alpha channel, only whether to respect it or discard it.
54 ]]
55 set {
56 [[Change alpha channel usage for this object.
57
58 This function sets a flag on an image object indicating
59 whether or not to use alpha channel data. A value of $true
60 makes it use alpha channel data, and $false makes it ignore
61 that data. Note that this has nothing to do with an object's
62 color as manipulated by @Efl.Gfx.Base.color.set.
63 ]]
64 }
65 get {
66 [[Retrieve whether alpha channel data is used on this object.]]
67 }
68 values {
69 alpha: bool; [[Whether to use alpha channel ($true) data
70 or not ($false).]]
71 }
72 }
49 73
50 @property stride { 74 @property stride {
51 [[Length in bytes of one row of pixels in memory. 75 [[Length in bytes of one row of pixels in memory.
diff --git a/src/lib/efl/interfaces/efl_image.eo b/src/lib/efl/interfaces/efl_image.eo
index 8a5d015c95..b0499a383e 100644
--- a/src/lib/efl/interfaces/efl_image.eo
+++ b/src/lib/efl/interfaces/efl_image.eo
@@ -1,3 +1,5 @@
1import efl_gfx_types;
2
1enum Efl.Image.Content_Hint 3enum Efl.Image.Content_Hint
2{ 4{
3 [[How an image's data is to be treated by EFL, for optimization.]] 5 [[How an image's data is to be treated by EFL, for optimization.]]
@@ -37,30 +39,6 @@ interface Efl.Image ()
37 smooth_scale: bool; [[Whether to use smooth scale or not.]] 39 smooth_scale: bool; [[Whether to use smooth scale or not.]]
38 } 40 }
39 } 41 }
40 @property alpha {
41 [[Indicates whether the alpha channel should be used.
42
43 This does not indicate whether the image source file contains
44 an alpha channel, only whether to respect it or discard it.
45 ]]
46 set {
47 [[Change alpha channel usage for this object.
48
49 This function sets a flag on an image object indicating
50 whether or not to use alpha channel data. A value of $true
51 makes it use alpha channel data, and $false makes it ignore
52 that data. Note that this has nothing to do with an object's
53 color as manipulated by @Efl.Gfx.Base.color.set.
54 ]]
55 }
56 get {
57 [[Retrieve whether alpha channel data is used on this object.]]
58 }
59 values {
60 alpha: bool; [[Whether to use alpha channel ($true) data
61 or not ($false).]]
62 }
63 }
64 @property ratio { 42 @property ratio {
65 [[The native width/height ratio of the image.]] 43 [[The native width/height ratio of the image.]]
66 get { 44 get {
diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo
index f71d822b6a..bf48249a75 100644
--- a/src/lib/evas/canvas/evas_image.eo
+++ b/src/lib/evas/canvas/evas_image.eo
@@ -53,8 +53,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An
53 Efl.File.save; 53 Efl.File.save;
54 Efl.Image.orientation.get; 54 Efl.Image.orientation.get;
55 Efl.Image.orientation.set; 55 Efl.Image.orientation.set;
56 Efl.Image.alpha.get;
57 Efl.Image.alpha.set;
58 Efl.Image.smooth_scale.set; 56 Efl.Image.smooth_scale.set;
59 Efl.Image.smooth_scale.get; 57 Efl.Image.smooth_scale.get;
60 Efl.Image.ratio.get; 58 Efl.Image.ratio.get;
@@ -89,6 +87,8 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An
89 Efl.Image_Load.load_region.get; 87 Efl.Image_Load.load_region.get;
90 Efl.Image_Load.load_region.set; 88 Efl.Image_Load.load_region.set;
91 Efl.Image_Load.load_region_support.get; 89 Efl.Image_Load.load_region_support.get;
90 Efl.Gfx.Buffer.alpha.get;
91 Efl.Gfx.Buffer.alpha.set;
92 Efl.Gfx.Buffer.buffer_update_add; 92 Efl.Gfx.Buffer.buffer_update_add;
93 Efl.Gfx.Buffer.stride.get; 93 Efl.Gfx.Buffer.stride.get;
94 Efl.Gfx.Buffer.colorspace.get; 94 Efl.Gfx.Buffer.colorspace.get;
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 8972f56641..9e69a4e481 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -936,7 +936,7 @@ _evas_image_efl_gfx_buffer_buffer_update_add(Eo *eo_obj, Evas_Image_Data *o, int
936} 936}
937 937
938EOLIAN static void 938EOLIAN static void
939_evas_image_efl_image_alpha_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool has_alpha) 939_evas_image_efl_gfx_buffer_alpha_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool has_alpha)
940{ 940{
941 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); 941 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
942 942
@@ -982,7 +982,7 @@ _evas_image_efl_image_alpha_set(Eo *eo_obj, Evas_Image_Data *o, Eina_Bool has_al
982} 982}
983 983
984EOLIAN static Eina_Bool 984EOLIAN static Eina_Bool
985_evas_image_efl_image_alpha_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) 985_evas_image_efl_gfx_buffer_alpha_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o)
986{ 986{
987 return o->cur->has_alpha; 987 return o->cur->has_alpha;
988} 988}
@@ -4368,13 +4368,15 @@ evas_object_image_fill_spread_get(const Evas_Image *obj EINA_UNUSED)
4368EAPI void 4368EAPI void
4369evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha) 4369evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool alpha)
4370{ 4370{
4371 efl_image_alpha_set(obj, alpha); 4371 EVAS_OBJECT_LEGACY_API(obj);
4372 efl_gfx_buffer_alpha_set(obj, alpha);
4372} 4373}
4373 4374
4374EAPI Eina_Bool 4375EAPI Eina_Bool
4375evas_object_image_alpha_get(const Evas_Object *obj) 4376evas_object_image_alpha_get(const Evas_Object *obj)
4376{ 4377{
4377 return efl_image_alpha_get(obj); 4378 EVAS_OBJECT_LEGACY_API(obj, EINA_FALSE);
4379 return efl_gfx_buffer_alpha_get(obj);
4378} 4380}
4379 4381
4380EAPI void 4382EAPI void