On 27.05.2010 at 12:33, MacArthur, Ian (SELEX GALILEO, UK) wrote:
> Does seem like there ought to be a more direct method though, I think -
> what do others feel about this?
Agreed.
> Some sort of (caution, more untested psuedo-code...)
>
> void fl_get_rgb_from_color(Fl_Color c, uchar&r, uchar&g, uchar&b) {
> if(c& 0xffffff00){
> r = (c>> 24)& 0xFF;
> g = (c>> 16)& 0xFF;
> b = (c>> 8)& 0xFF;
> }
> else {
> unsigned rgb = fl_cmap[(c& 0xFF)];
> r = (rgb>> 24)& 0xFF;
> g = (rgb>> 16)& 0xFF;
> b = (rgb>> 8)& 0xFF;
> }
> }
>
> This would go in fl_color.c I guess? Not actually tested this though...
Looks good, although I would shorten the function name, maybe
fl_rgb_from_color, fl_color_to_rgb, or ... ?
And, while we're at it, Edzard's proposal could be added as well,
Fl::background(Fl_Color);
Fl::background2(Fl_Color);
Should be simple, just two overloaded methods calling the existing
functions.
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk