On Sat, Aug 14, 2010 at 8:38 AM, Ken Resander <kresan...@yahoo.com> wrote:

>
>


> Q2. while googling I came across this for GdkColor: 'the programmer
> provides the r,g and b intensities and GDK fills in the pixel component.'
> When does GDK do this? By what functions?
>
> Q3. I have tried reading about Colormaps and Colors in the GDK reference
> manual, but I am getting stuck on the basics. For example in the Description
> what does this mean: 'A colormap is an object that contains the mapping
> between the color values stored in memory and the RGB values that are used
> to display color values. In general, colormaps only contain significant
> information for pseudo-color visuals, but even for other visual types, a
> colormap object is required in some circumstances.' Does it mean 'a colormap
> is a list of GdkColors like a palette'?  Is the RGB value mentioned in the
> description the pixel component in the GdkColor?
>
> Q4. For GdkColor the manual says 'the GdkColor structure is used to
> describe an allocated or unallocated color'. What does allocated and
> unallocated color mean?
>
> Q5. The Colormaps and Colors Reference contains several functions, but I
> did not use any of them. It still worked with the colours coming out the way
> I expected. When are these functions used/needed? Or are they becoming
> obsolete?



they are not obsolete, but they represent a deeper "model" of how color
rendering works on a framebuffer display than most developers will ever
need. its generally just fine for you to think in terms of "i need a red
color, so i'll create it, and then use that to draw with". this actually is
not what happens deeper in the graphics stack, and because X Window (the
first platform that GDK was written on) tends to expose these "deeper"
concepts, they've shown up in GDK too.

there are some places where the difference between "i need red, so i'll
create it and use it" and what actually happens does matter, but if you only
write applications with GTK and don't tend to hack on GTK itself, you will
probably need to worry about them.

--p



>
>
>
>
>
> --- On *Fri, 13/8/10, Ken Resander <kresan...@yahoo.com>* wrote:
>
>
> From: Ken Resander <kresan...@yahoo.com>
> Subject: Any RGB macro in Gtk?
> To: gtk-list@gnome.org
> Date: Friday, 13 August, 2010, 6:48 PM
>
>
> 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)))
>
>
>
> -----Inline Attachment Follows-----
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org <http://mc/compose?to=gtk-l...@gnome.org>
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to