interface: add Efl.Gfx.Color interface for color related APIs

This would eventually turn into mixin class later after adding
more color related helper functions.
This commit is contained in:
Amitesh Singh 2017-12-20 16:34:01 +09:00
parent 14d10e8b7b
commit 9db0ec554b
23 changed files with 83 additions and 73 deletions

View File

@ -2,6 +2,7 @@
efl_eolian_legacy_files = \
lib/efl/interfaces/efl_gfx_fill.eo \
lib/efl/interfaces/efl_gfx.eo \
lib/efl/interfaces/efl_gfx_color.eo \
lib/efl/interfaces/efl_image.eo \
lib/efl/interfaces/efl_image_animated.eo \
lib/efl/interfaces/efl_input_device.eo \

View File

@ -115,6 +115,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
/* Graphics */
#include "interfaces/efl_gfx.eo.h"
#include "interfaces/efl_gfx_color.eo.h"
#include "interfaces/efl_gfx_buffer.eo.h"
#include "interfaces/efl_gfx_stack.eo.h"
#include "interfaces/efl_gfx_fill.eo.h"

View File

@ -49,46 +49,6 @@ interface Efl.Gfx {
rect: Eina.Rect; [[The X,Y position and W,H size, in pixels.]]
}
}
@property color {
set {
[[Sets the general/main color of the given Evas object to the given
one.
See also @.color.get (for an example)
These color values are expected to be premultiplied by alpha.
]]
}
get {
[[Retrieves the general/main color of the given Evas object.
Retrieves the main color's RGB component (and alpha channel)
values, which range from 0 to 255. For the alpha channel,
which defines the object's transparency level, 0 means totally
transparent, while 255 means opaque. These color values are
premultiplied by the alpha value.
Usually youll use this attribute for text and rectangle objects,
where the main color is their unique one. If set for objects
which themselves have colors, like the images one, those colors
get modulated by this one.
All newly created Evas rectangles get the default color
values of 255 255 255 255 (opaque white).
Use null pointers on the components you're not interested
in: they'll be ignored by the function.
See the full \@ref Example_Evas_Object_Manipulation "example".
]]
}
values {
r: int; [[The red component of the given color.]]
g: int; [[The green component of the given color.]]
b: int; [[The blue component of the given color.]]
a: int; [[The alpha component of the given color.]]
}
}
@property visible {
[[The visibility of a canvas object.

View File

@ -3,7 +3,7 @@ interface Efl.Gfx.Blur
[[A simple API to apply blur effects.
Those API's might use @Efl.Gfx.Filter internally. It might be necessary to
also specify the color of the blur with @Efl.Gfx.color.
also specify the color of the blur with @Efl.Gfx.Color.color.
]]
methods {
@property radius {

View File

@ -61,7 +61,7 @@ interface Efl.Gfx.Buffer ()
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.color.set.
color as manipulated by @Efl.Gfx.Color.color.set.
]]
}
get {

View File

@ -0,0 +1,46 @@
interface Efl.Gfx.Color
{
[[Efl Gfx Color interface class]]
methods {
@property color @pure_virtual {
set {
[[Sets the general/main color of the given Evas object to the given
one.
See also @.color.get (for an example)
These color values are expected to be premultiplied by alpha.
]]
}
get {
[[Retrieves the general/main color of the given Evas object.
Retrieves the main color's RGB component (and alpha channel)
values, which range from 0 to 255. For the alpha channel,
which defines the object's transparency level, 0 means totally
transparent, while 255 means opaque. These color values are
premultiplied by the alpha value.
Usually youll use this attribute for text and rectangle objects,
where the main color is their unique one. If set for objects
which themselves have colors, like the images one, those colors
get modulated by this one.
All newly created Evas rectangles get the default color
values of 255 255 255 255 (opaque white).
Use null pointers on the components you're not interested
in: they'll be ignored by the function.
See the full \@ref Example_Evas_Object_Manipulation "example".
]]
}
values {
r: int;
g: int;
b: int;
a: int;
}
}
}
}

View File

@ -26,6 +26,7 @@
#include "interfaces/efl_text_markup.eo.c"
#include "interfaces/efl_gfx.eo.c"
#include "interfaces/efl_gfx_color.eo.c"
#include "interfaces/efl_gfx_buffer.eo.c"
#include "interfaces/efl_gfx_stack.eo.c"
#include "interfaces/efl_gfx_fill.eo.c"

View File

@ -148,7 +148,7 @@ elm_bg_color_set(Evas_Object *obj,
}
EOLIAN static void
_efl_ui_bg_widget_efl_gfx_color_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd, int r, int g, int b, int a)
_efl_ui_bg_widget_efl_gfx_color_color_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd, int r, int g, int b, int a)
{
efl_gfx_color_set(sd->rect, r, g, b, a);
}
@ -164,7 +164,7 @@ elm_bg_color_get(const Evas_Object *obj,
}
EOLIAN static void
_efl_ui_bg_widget_efl_gfx_color_get(Eo *obj, Efl_Ui_Bg_Widget_Data *sd, int *r, int *g, int *b, int *a)
_efl_ui_bg_widget_efl_gfx_color_color_get(Eo *obj, Efl_Ui_Bg_Widget_Data *sd, int *r, int *g, int *b, int *a)
{
if (!sd->rect)
efl_gfx_color_get(efl_super(obj, MY_CLASS), r, g, b, a);

View File

@ -12,7 +12,7 @@ class Efl.Ui.Bg_Widget (Efl.Ui.Layout, Efl.Ui.Bg, Efl.Image.Load)
Efl.Object.constructor;
Efl.File.file { get; set; }
Efl.File.mmap { get; set; }
Efl.Gfx.color { get; set; }
Efl.Gfx.Color.color { get; set; }
Efl.Image.scale_type { get; set; }
Efl.Image.Load.load_size { get; set; }
}

View File

@ -696,7 +696,7 @@ _efl_ui_image_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Image_Data *sd,
}
EOLIAN static void
_efl_ui_image_efl_gfx_color_set(Eo *obj, Efl_Ui_Image_Data *sd, int r, int g, int b, int a)
_efl_ui_image_efl_gfx_color_color_set(Eo *obj, Efl_Ui_Image_Data *sd, int r, int g, int b, int a)
{
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_COLOR_SET, 0, r, g, b, a))
return;

View File

@ -19,8 +19,8 @@ struct Efl.Ui.Image.Error
}
class Efl.Ui.Image (Elm.Widget, Efl.Ui.Clickable, Efl.Ui.Draggable,
Efl.File, Efl.Image, Efl.Image.Load, Efl.Player, Efl.Gfx.View,
Efl.Access.Image, Efl.Access.Widget.Action,
Efl.File, Efl.Image, Efl.Image.Load, Efl.Player, Efl.Gfx.View,
Efl.Access.Image, Efl.Access.Widget.Action, Efl.Gfx.Color,
Efl.Orientation, Efl.Flipable,
Efl.Ui.View, Efl.Ui.Model.Connect, Efl.Layout.Calc,
Efl.Layout.Group, Efl.Layout.Signal)
@ -92,7 +92,7 @@ class Efl.Ui.Image (Elm.Widget, Efl.Ui.Clickable, Efl.Ui.Draggable,
Efl.Object.constructor;
Efl.File.file { get; set; }
Efl.File.mmap { set; }
Efl.Gfx.color { set; }
Efl.Gfx.Color.color { set; }
Efl.Gfx.visible { set; }
Efl.Gfx.position { set; }
Efl.Gfx.size { set; }

View File

@ -1,11 +1,11 @@
class Efl.Ui.Widget.Part_Bg (Efl.Ui.Widget.Part, Efl.Ui.Bg)
class Efl.Ui.Widget.Part_Bg (Efl.Ui.Widget.Part, Efl.Gfx.Color, Efl.Ui.Bg)
{
[[Elementary widget internal part background class]]
data: null;
implements {
Efl.File.file { get; set; }
//Efl.File.mmap { get; set; }
Efl.Gfx.color { set; get; }
Efl.Gfx.Color.color { set; get; }
Efl.Image.scale_type { get; set; }
}
}

View File

@ -1,4 +1,4 @@
class Efl.Ui.Widget.Part_Shadow (Efl.Ui.Widget.Part, Efl.Gfx,
class Efl.Ui.Widget.Part_Shadow (Efl.Ui.Widget.Part, Efl.Gfx, Efl.Gfx.Color,
Efl.Gfx.Blur, Efl.Gfx.Filter)
{
[[A drop-shadow or glow effect around any widget.
@ -22,7 +22,7 @@ class Efl.Ui.Widget.Part_Shadow (Efl.Ui.Widget.Part, Efl.Gfx,
]]
data: null;
implements {
Efl.Gfx.color { set; get; }
Efl.Gfx.Color.color { set; get; }
Efl.Gfx.Blur.radius { set; get; }
Efl.Gfx.Blur.offset { set; get; }
Efl.Gfx.Blur.grow { set; get; }

View File

@ -7303,7 +7303,7 @@ _efl_ui_win_part_file_get(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const
/* Efl.Part begin */
static void
_efl_ui_win_part_efl_gfx_color_set(Eo *obj, void *_pd EINA_UNUSED, int r, int g, int b, int a)
_efl_ui_win_part_efl_gfx_color_color_set(Eo *obj, void *_pd EINA_UNUSED, int r, int g, int b, int a)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
@ -7315,7 +7315,7 @@ _efl_ui_win_part_efl_gfx_color_set(Eo *obj, void *_pd EINA_UNUSED, int r, int g,
}
static void
_efl_ui_win_part_efl_gfx_color_get(Eo *obj, void *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
_efl_ui_win_part_efl_gfx_color_color_get(Eo *obj, void *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);

View File

@ -1,11 +1,12 @@
class Efl.Ui.Win.Part (Efl.Ui.Widget.Part, Efl.Content, Efl.Gfx, Efl.File)
class Efl.Ui.Win.Part (Efl.Ui.Widget.Part, Efl.Content, Efl.Gfx, Efl.Gfx.Color,
Efl.File)
{
[[Efl UI window interal part class]]
data: null;
implements {
Efl.Content.content { get; set; }
Efl.Content.content_unset;
Efl.Gfx.color { get; set; }
Efl.Gfx.Color.color { get; set; }
Efl.File.file { get; set; }
}
}

View File

@ -886,7 +886,7 @@ _elm_widget_efl_gfx_visible_set(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool vi
}
EOLIAN static void
_elm_widget_efl_gfx_color_set(Eo *obj, Elm_Widget_Smart_Data *pd, int r, int g, int b, int a)
_elm_widget_efl_gfx_color_color_set(Eo *obj, Elm_Widget_Smart_Data *pd, int r, int g, int b, int a)
{
Eina_Iterator *it;
Evas_Object *o;
@ -5780,7 +5780,7 @@ _efl_ui_widget_part_shadow_efl_gfx_blur_radius_get(Eo *obj, void *_pd EINA_UNUSE
}
EOLIAN static void
_efl_ui_widget_part_shadow_efl_gfx_color_set(Eo *obj, void *_pd EINA_UNUSED, int r, int g, int b, int a)
_efl_ui_widget_part_shadow_efl_gfx_color_color_set(Eo *obj, void *_pd EINA_UNUSED, int r, int g, int b, int a)
{
Widget_Shadow *shadow = _widget_shadow_part_get(obj);
shadow->props.r = r;
@ -5791,7 +5791,7 @@ _efl_ui_widget_part_shadow_efl_gfx_color_set(Eo *obj, void *_pd EINA_UNUSED, int
}
EOLIAN static void
_efl_ui_widget_part_shadow_efl_gfx_color_get(Eo *obj, void *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
_efl_ui_widget_part_shadow_efl_gfx_color_color_get(Eo *obj, void *_pd EINA_UNUSED, int *r, int *g, int *b, int *a)
{
Widget_Shadow *shadow = _widget_shadow_part_get(obj);
if (r) *r = shadow->props.r;
@ -5956,7 +5956,7 @@ _efl_ui_widget_part_bg_efl_file_file_get(Eo *obj, void *pd EINA_UNUSED, const ch
}
EOLIAN static void
_efl_ui_widget_part_bg_efl_gfx_color_set(Eo *obj, void *pd EINA_UNUSED, int r, int g, int b, int a)
_efl_ui_widget_part_bg_efl_gfx_color_color_set(Eo *obj, void *pd EINA_UNUSED, int r, int g, int b, int a)
{
Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
@ -5964,7 +5964,7 @@ _efl_ui_widget_part_bg_efl_gfx_color_set(Eo *obj, void *pd EINA_UNUSED, int r, i
}
EOLIAN static void
_efl_ui_widget_part_bg_efl_gfx_color_get(Eo *obj, void *pd EINA_UNUSED, int *r, int *g, int *b, int *a)
_efl_ui_widget_part_bg_efl_gfx_color_color_get(Eo *obj, void *pd EINA_UNUSED, int *r, int *g, int *b, int *a)
{
Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);

View File

@ -580,7 +580,7 @@ abstract Elm.Widget (Efl.Canvas.Group, Efl.Access,
Efl.Object.destructor;
Efl.Object.provider_find;
Efl.Object.debug_name_override;
Efl.Gfx.color { set; }
Efl.Gfx.Color.color { set; }
Efl.Gfx.visible { set; }
Efl.Gfx.position { set; }
Efl.Gfx.size { set; }

View File

@ -129,7 +129,7 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Object.debug_name_override;
Efl.Gfx.color { set; }
Efl.Gfx.Color.color { set; }
Efl.Gfx.visible { set; }
Efl.Gfx.position { set; }
Efl.Canvas.Object.clip { set; }

View File

@ -1,7 +1,7 @@
import efl_text_types;
import efl_animation_types;
abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Color, Efl.Gfx.Stack, Efl.Animator,
Efl.Input.Interface, Efl.Gfx.Size.Hint,
Efl.Gfx.Map, Efl.Loop.Consumer, Efl.Ui.Base, Efl.Canvas.Pointer)
{
@ -598,7 +598,7 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
Efl.Object.del;
Efl.Object.debug_name_override;
Efl.Gfx.visible { get; set; }
Efl.Gfx.color { get; set; }
Efl.Gfx.Color.color { get; set; }
Efl.Gfx.geometry { get; set; }
Efl.Gfx.position { get; set; }
Efl.Gfx.size { get; set; }

View File

@ -1,6 +1,6 @@
import eina_types;
abstract Efl.VG (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Duplicate)
abstract Efl.VG (Efl.Object, Efl.Gfx, Efl.Gfx.Color, Efl.Gfx.Stack, Efl.Duplicate)
{
[[Efl vector graphics abstract class]]
eo_prefix: efl_vg;
@ -109,7 +109,7 @@ abstract Efl.VG (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Duplicate)
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Gfx.visible { get; set; }
Efl.Gfx.color { get; set; }
Efl.Gfx.Color.color { get; set; }
Efl.Gfx.size { get; }
Efl.Gfx.position { get; set; }
Efl.Gfx.geometry { get; }

View File

@ -2128,7 +2128,7 @@ evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
}
EOLIAN static void
_efl_canvas_object_efl_gfx_color_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
_efl_canvas_object_efl_gfx_color_color_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
int r, int g, int b, int a)
{
int prev_a;
@ -2175,7 +2175,7 @@ evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
}
EOLIAN static void
_efl_canvas_object_efl_gfx_color_get(Eo *eo_obj EINA_UNUSED,
_efl_canvas_object_efl_gfx_color_color_get(Eo *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj,
int *r, int *g, int *b, int *a)
{

View File

@ -845,7 +845,7 @@ _efl_canvas_group_efl_canvas_object_no_render_set(Eo *eo_obj, Evas_Smart_Data *o
}
EOLIAN static void
_efl_canvas_group_efl_gfx_color_set(Eo *eo_obj, Evas_Smart_Data *o, int r, int g, int b, int a)
_efl_canvas_group_efl_gfx_color_color_set(Eo *eo_obj, Evas_Smart_Data *o, int r, int g, int b, int a)
{
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_COLOR_SET, 0, r, g, b, a))
return;

View File

@ -118,7 +118,7 @@ _efl_vg_efl_gfx_visible_get(Eo *obj EINA_UNUSED,
}
static void
_efl_vg_efl_gfx_color_set(Eo *obj EINA_UNUSED,
_efl_vg_efl_gfx_color_color_set(Eo *obj EINA_UNUSED,
Efl_VG_Data *pd,
int r, int g, int b, int a)
{
@ -155,7 +155,7 @@ _efl_vg_efl_gfx_color_set(Eo *obj EINA_UNUSED,
}
static void
_efl_vg_efl_gfx_color_get(Eo *obj EINA_UNUSED,
_efl_vg_efl_gfx_color_color_get(Eo *obj EINA_UNUSED,
Efl_VG_Data *pd,
int *r, int *g, int *b, int *a)
{