Re: GdkPixmap bugs



Ron Steinke <rsteinke w-link net> writes:

> > From: Owen Taylor <otaylor redhat com>
> >
> > Ron Steinke <rsteinke w-link net> writes:
> >
> > > > From: Owen Taylor <otaylor redhat com>
> > > >
> > > > And the colormap handling in gdk_pixmap_new() needs special-casing 
> > > > for the case where the depth of the window is not the
> > > > same as the depth of the new pixmap. In the case where
> > > > depth == 1, we may be able to supply a proper default colormap,
> > > 
> > > How would you go about creating a GdkVisual of depth 1?
> >
> > Thinking about it before ... my comment is really nonsensical.
> >
> > The right thing to do when creating a pixmap where the depth of the
> > pixmap doesn't match the depth of the supplied window (or the root
> > window, if window is passed in as NULL), is always to leave the
> > colormap unset.
> >
> >
> > You can't actual "create" a visual - the set of visuals is fixed.
> >
> > X's model is actually a little bizarre - you can create pixmaps of
> > depths for which there is no corresponding visual and colormap. (The
> > list of allowed depths for a screen can be retrieved with
> > XListDepths(), something not exposed through GTK+)
> >
> > The uses of this are:
> >
> >  - For traditional X rendering, depth 1 bitmaps for masks,
> >    XCopyPlane, etc.
> >
> >  - For the Xrender extensions, alpha masks, 24 bit images offscreen
> >    images, etc.
> 
> So what is the correct Gdk way of doing things like:
> 
> reading the bitmap data, a la gdk_get_image()

gdk_image_get() should work with bitmaps. If it doesn't it
needs fixing. After all, gdk_image_get() just returns the 
raw bits.

But gdk_pixbuf_get_from_drawable() shouldn't be expected to
work unless you have a 1-bit display ... there is no interpretation
of colors for a bitmap normally.
 
> setting the foreground color of the bitmap graphics context
> so that you can use the drawing routines, e.g. gdk_draw_polygon()

 GdkColor zero_color = { 0, };
 GdkColor one_color = { 1, };

 gdk_gc_set_foreground (gc, &zero_color);

Operations with bitmaps (gdk_gc_set_stipple, etc) are always 
described in terms of 0s and 1s, not black and white.

Regard,s
                                        Owen






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