Re: setting colormap for bitmaps
- From: Owen Taylor <otaylor redhat com>
- To: Ron Steinke <rsteinke w-link net>
- Cc: gtk-devel-list gnome org
- Subject: Re: setting colormap for bitmaps
- Date: 17 Jul 2001 14:14:41 -0400
Ron Steinke <rsteinke w-link net> writes:
> > From: Owen Taylor <otaylor redhat com>
> >
> > Ron Steinke <rsteinke w-link net> writes:
> >
> > > 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.
>
> Then how would you do something line gdk_draw_rectangle() to
> initialize a newly created pixmap? Does setting the GdkFunction
> in the GdkGC work with all the drawing routines, or just gdk_draw_drawable()?
How did you want to intialize your bitmap? Say you wanted to initialize
it to all zeros:
GdkColor zero_color = { 0. };
GdkGC *gc = gdk_gc_new (bitmap);
gdk_gc_set_foreground (gc, &zero_color);
gdk_draw_rectangle (rectangle, gc, TRUE, 0, 0, 100, 100);
Or, as (perhaps you perhaps you had in mind above)
GdkGC *gc = gdk_gc_new (bitmap);
gdk_gc_set_function (gc, GDK_CLEAR);
gdk_draw_rectangle (rectangle, gc, TRUE, 0, 0, 100, 100);
Both work, and there shouldn't be a big difference in efficiency between
them.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]