Re: [AD] colors addon

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, 2008-12-20 at 10:11 +1100, Peter Wang wrote:
> 
> I still question the colour names though.  Firstly, I think they'd only
> be useful for example programs where you don't care exactly what colour
> you're getting.

Yes, but the same is true for RGB. If you use "0/0.2/0" or "#002f00" or
"darkgreen" to specify a color, you will only know the exact shade of
green once you see the color, never from the RGB or the name.

According to Wikipedia also CSS and .NET recognize these color names, so
some people apparently prefer them over RGB.

>   Secondly, if you do care about what colour you're
> getting, it'd be easier to enter the RGB components directly than to
> look up the name (in general).

Well, I'll have to look the color up in either case, so equally
easy/hard. One advantage might be though that:

color = C("olive")

is more readable than

color = C(128, 128, 0) // olive

especially if there's no comment.

>   Thirdly, the annoyance in small example
> programs is having to declare any initialise colour variables like:
> 
>     ALLEGRO_COLOR white;
>     ...
>     white = al_map_rgb(255, 255, 255);
> 
> This interface does nothing to solve that:
> 
>     int al_color_name_to_rgb(char const *name, float *r, float *g, float *b);
> 
> It doesn't return an ALLEGRO_COLOR directly, and you still have to
> define the variable and initialise it anyway.
> 

Yeah, I was thinking about having an additional version for all *_to_rgb
functions which returns an ALLEGRO_COLOR instead of having the r,g,b
output variables, so it would be like:

color1 = al_color_hsv(180, 1, 1)
color2 = al_color_name("white")

They would simply call al_color_[hsv|name]_to_rgb() and then
al_map_rgb().

But I got stuck in the middle of researching CMYK and YUV converters :)

Anyway, I'm not sure myself if it should be put into the addons folder
in the main SVN repository or not. If this is put there, then why not
someone's GUI addon which likely is something more useful than HSV
conversion or color names lookup.

My main argument in favor of putting it there is that I feel too lazy to
figure out a way how to neatly integrate external addons to the build
system - so likely for now the install instructions would say "Unzip it
into the addons folder, then edit Allegro's SConstruct and add 'color'
in the list of addons and re-compile and re-install Allegro - now also
the addon should be installed." :)

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/