I said:
> > Anybody know how that's done?
Albrecht replied:
> Not directly, but this trick should do it:
>
> unsigned rgb = (unsigned)fl_color_average((Fl_Color)i,
> FL_WHITE, 1.0);
>
> r = rgb>> 24 & 255;
> g = rgb>> 16 & 255;
> b = rgb>> 8 & 255;
>
> i can be any color (index or RGB value).
> FL_WHITE can be replaced with any color.
Oh - that's quite sneaky though! I had not thought of that, but that
should work.
Does seem like there ought to be a more direct method though, I think -
what do others feel about this?
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...
--
Ian
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk