[cairo] drawing into GDK bitmap (pixmap of depth 1)?

Owen Taylor otaylor at redhat.com
Mon Feb 20 13:57:56 PST 2006


On Mon, 2006-02-20 at 13:15 -0800, Eric Smith wrote:
> Owen wrote:
> > IIRC, when you use a GTK+ bitmap with Cairo it's treated as a 1-bit
> > alpha bitmap, so you might want to try adjusting you code appropriately.
> 
> OK.  That's an interesting interpretation, and I never would have guessed
> that.
> 
> > Try - set_operator(CAIRO_CLEAR); cairo_fill(); rather than painting
> > with black.
> 
> That solved the problem.
> 
> So with CAIRO_OPERATOR_SOURCE, anything I stroke or fill in a bitmap
> is going to be "white" (non-clear)?

With SOURCE, it will depend on whether you have alpha in your source
color/image or not. If you use a rgba source with an alpha of 0, you'll
get 0s in the bitmap, if  you use an rgba source with an alpha of 1,
you'll get 1s.

(On the other hand, with the default OVER, you'll have no way of 
drawing with 0s... you can just increase the alpha value, never
decrease it.)

Regards,
						Owen




More information about the cairo mailing list