I agree with you.

1. i think we can provide 2 types of apis for app convenient.

a. efl_gfx_color_rgba_set(o,  r, g, b, a); or whatever api.
No doubts to this api. This essentially could be used in general cases.
ie), efl_gfx_color_rgba_set(o, 255, 0, 0, 255);

b. efl_gfx_color_set(o, color ); or whatever api.
If app needs to keep the color info (ie, for color transition), they will have 
r, g, b, a channel values in their context data.
In that case, they'd like to pass just the color strucuture.

Eina_Bool anim_cb(void data, const Eo_Event *event)
{
   Context *ctx = data;
   ctx.color.r *= ..;
   ctx.color.g *= ..;
   ctx.color.b *= ..;
 
   efl_gfx_color_set(o, ctx.color);
}

2. Premultiplied helper function will be handy also.

-----Original Message-----
From: "Conrad Um"<[email protected]> 
To: "Enlightenment developer list"<[email protected]>; 
Cc: 
Sent: 2016-05-30 (́›”) 14:03:43
Subject: [E-devel] What about using Efl.Gfx.Color instead of 4 integers?
 
In Efl layer, there is a data type named as Efl.Gfx.Color which contains
four members (r, g, b, a) & its type (8bits or 16bits). Then why aren't we
using Efl.Gfx.Color instead of 4 integers.

   efl_gfx_color_set(obj, color); // color is Efl.Gfx.Color data structure

Moreover, inline methods (helper) can be added which passes 4 integers and
returns Efl.Gfx.Color. These helper functions can provide conversion
between premultiplied and straight color.

evas_object_color_set() uses premultiplied color, but
edje_object_color_set() uses straight one. They are not inconsistent. Even
though EDC uses straight (because it can be used by designer), but using
premultiplied in API level seems more consistent.
I'm making APIs to change the color of Elemenatry widget by using
edje_object_color_class_set() internally, but their name like
evas_object_color_set(). (eg: elm_object_color_set())
The problem which type of color will be used still exists here.

Only my concern is that manual conversion between premultiplied and
straight is annoying. This work can be done by helper functions mentioned
above.
Please give your ideas about this. Thank you.

Best Regards,
conr2d (Jee-Yong Um)
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to