Re: setting colormap for bitmaps



Ron Steinke <rsteinke w-link net> writes:

> 	I've put a patch on bugzilla (bug #57604) to ensure that
> the depth of a drawable and the depth of its colormap's visual
> match. This means, however, that if X doesn't provide a visual
> of depth 1, certain things don't work for bitmaps:
> 
> gdk_drawable_get_image()	(already broken previously)

Well, broken fairly recently. I think this just needs some 
special-casing for bitmaps. 

[ The exact way to do this may take some research ]
 
> setting the foreground color in a GdkGC for a bitmap, since there
> is no colormap to allocate the color in. This breaks code
> which, for example, draws a rectangle to a newly created bitmap
> to clear it.

You cannot make any assumptions about whether black is 0 or 1 in a
bitmap. So, calling gdk_gc_set_rgb_fg_color() on a GC for a bitmap
doesn't make sense, since what you care about is 0's vs. 1's.
 
> There are probably other examples. The only way to fix this while
> maintaining the drawable/visual depth match is to ensure that
> the x11 implementation provides a visual of depth 1. If that
> isn't working automatically (as it's not in my case, with
> a fairly standard Debian XFree86 version 3.3.6 installation),
> there are three basic options:
> 
> 1. Get the X server to create a visual with depth of 1. I don't
> 	know if this is sensible or even possible.

No, this is not possible.
 
> 2. Create a `fake' GdkVisual with no corresponding visual under X.

Possible, but doesn't actually save anything.
 
> 3. Create a GdkColormap with a NULL visual.

Would complicate a lot of code without any real improvements.
 
> I don't know if any of these make any sense. Comments from anyone with
> X experience? Are there options I'm missing?

Well, the obvious answer is to simply fix gdk_drawable_get_image() for
bitmaps to work without a visual for the drawable.

Regards,
                                            Owen







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