> That works, but next step is to replace fl_rgb_color() by 
> fl_show_colormap() and this way the problem comes back.
> 
> When checking the values I found, that fl_show_colormap() provides an 
> index to colormap-table, i.e. when clicking to red (second 
> field) there 
> results the index "1". Using this i.e. for color(Fl_Color) out of 
> fl_draw, it works well.
> So I think, my question basically was right, but could have been more 
> detailed: How to convert Fl_Color-index-value to RGB?

(Some of what follows is speculation!)

The fltk color type is 32-bits, encoded as RGBI, with a byte each for R,
G, B and I (I being the index into the colour map.)

Now, so far as I can make out, most of the fltk code seems to encode
colours such that they are rrggbb00 for RGB colours, or 000000ii for
index colours.

The fltk code seems to test for this by masking the colour value with
0xffffff00 and if that is non-zero, it treats it as RGB.

If that is zero, it masks with 0x000000FF and then looks up the related
RGB values by doing a lookup into fl_cmap[] array.

(pseudo code...)

        int i = c & 0x000000ff;
        unsigned rgb = fl_cmap[i];
        r = rgb >> 24;
        g = rgb >> 16;
        b = rgb >> 8;

(e.g. see fl_color_win32.cxx etc near line 111 of fltk-1.3)

The problem with this seems to be that the fl_cmap[] array is static,
and I don't see how we get access to those values easily...

Anybody know how that's done?




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

Reply via email to