Re: Missing gdk_draw_pixbuf()



On Mon, Nov 11, 2002 at 12:13:21AM -0500, Michael Rothwell wrote:

Follow-up:

mask = gdk_pixmap_new(widget->window,childMapSize.X,childMapSize.Y,1);
                              
                              gdk_pixbuf_render_to_drawable_alpha(pixbuf,mask,
               0,0,0,0,childMapSize.X,childMapSize.Y,
               GDK_PIXBUF_ALPHA_BILEVEL,
               1,GDK_RGB_DITHER_NORMAL,0,0);

Gdk-WARNING **: The gdk_draw_*_image require the drawable argument to
have a specified colormap. All windows have a colormap,
however, pixmaps only have colormap by default if they
were created with a non-NULL window argument. Otherwise
a colormap must be set on them with gdk_drawable_set_colormap

... I created the pixmap with a non-NULL window argument (inside an 
expose handler). Yet...

The message is slightly inaccurate, in that providing a window only
works if you're creating a pixmap with the same depth as the window.
In this case you're creating a bitmap (depth = 1).

Bitmaps don't really have colormaps, they are just whatever color you
draw them with. (You can't gdk_draw_pixmap() a bitmap to a drawable,
because the bitmap depth doesn't match the drawable depth; instead you
can say draw a rectangle with the bitmap as clip mask, which ends up
having the rectangle color. Well, you can gdk_draw_pixmap one bitmap
to another bitmap, but in that case the result is still a "colorless"
mask.)

To get a bitmap matching a pixbuf's alpha channel, you'd normally use
gdk_pixbuf_render_threshold_alpha() instead of
render_to_drawable_alpha().

render_to_drawable_alpha could probably do something where it makes
all pixels over a certain intensity be "on" (I think gdkrgb already
does that), and this could even not bother requiring a colormap.  But
it doesn't work that way right now.

Havoc





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