Any RGB macro in Gtk?



I would like to port some Windows programs to Ubuntu+Gtk. These contain several large colour lookup tables using the Windows RGB macro. For example:

static COLALTINFO safealts [ NUMCOLITEMS ]
   =
   {
   { RGB(0xF0,0xF8,0xFF),RGB(0xFF,0xFF,0xFF) ,RGB(0x00,0x00,0x00) },
   { RGB(0xFA,0xEB,0xD7),RGB(0xFF,0xFF,0xCC) ,RGB(0x00,0x00,0x00) },
   ....

I have not done any drawing yet with Gtk and don't know how colours work, but there are thousands of RGB macro calls and it would very tedious and error prone if I have to change them manually. I really don't want to touch the RGB colour values in the lookup tables, but I probably would have change the COLALTINFO definition to match the way Gtk represents colour.

Is there a RGB macro in Gtk/Gdk, or can such macro be written?
 
P.S.
The Windows RGB macro builds a 24-bit int constant (COLORREF).
and is defined as follows:

#define RGB(r, g ,b)  ((DWORD) (((BYTE) (r) | \
                      ((WORD) (g) << 8)) | \
                      (((DWORD) (BYTE) (b)) << 16)))




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]