Re: How to use the GdkColor.pixel



Owen Taylor wrote:
On Thu, 2003-12-11 at 12:14, Tom Liu wrote:

Thanks!, I understand now.
But, how to get the rgb value of a allocated color? In my application, I
allocated a lot of color when I start program, should I use RGB value?

I'd just use RGB values and let GTK+ worry about allocating them,
normally. (gdk_colormap_query_color() can be used to find the RGB
of an allocated color.)

How about for performance?  Every time to use GdkColor in GTK+,
internally it need to go alloc the color, will this slow down?

On any modern display (TrueColor), gdk_colormap_alloc_color() is really fast - it's just a few bitshifts.

But even on older pseudo-color displays, letting GTK+ allocate
the color will generally be quite fast enough ... if the color is
already in use, it can find it without having to ask the X server to
allocate a new color.

IIRC, pseudo color goes thru a colormap table, so you can change
a displayed color by changing its table entry instead of having to
redraw. Can most X servers be assumed to have pseudo color?




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