Re: ABI rules on accessing colormap->colors?



On Mon, 2003-09-15 at 00:45, Peter Zelezny wrote:
Hi All,

I want to use the "colors" field of a GdkColormap object. The current docs say:

gint size     For pseudo-color colormaps, the number of colors in the colormap.
GdkColor *colors      An array containing the current values in the colormap. This
can be used to map from pixel values back to RGB values. This is only
meaningful for pseudo-color colormaps.

On a TrueColor visual, I'm getting a size of 64 and colors of NULL (I'm not
sure if this is uninitialized or a proper NULL). On a 8bit PseudoColor server,
I get a size of 256 and ->colors are a valid array.

Before I try to access cmap->colors, what should I be checking?

a) if cmap->colors is NULL
b) if visual->type == PseudoColor
c) if cmap->size == 0
d) something else?

Well, cmap->colors is going to have correct values for static color
and grayscale as well as pseudocolor .... so checking ->colors != NULL
is probably the most general thing to do.

But why not just use gdk_colormap_query_color() and let GTK+ worry
about this?

Regards,
                                                        Owen





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