[Qt-interest] Draw an 1-bit mask in color?

Stephen Chu stephen at ju-ju.com
Tue Mar 9 17:45:58 CET 2010


In article <stephen-389DC2.10241809032010 at nntp.trolltech.com>,
 Stephen Chu <stephen at ju-ju.com> wrote:

> Is there a way to draw a 1-bit mask image in color?
> 
> I have an runtime generated 1-bit mask and need to draw the mask in an 
> user specified color over other graphics items. The 1s in the bitmap 
> need to be in the user color and 0s as transparent.
> 
> From the doc, it seems that I need to create a QPixmap and fill it with 
> the color. Then setMask using the bitmap. This seems to be a lot of work 
> (and memory) to do something simple.
> 
> Thanks.

OK. I find out about the special case when drawing a QBitmap. Using 
TransparentMode and setPen, I am able to draw the mask in the color.

Thanks.

-- 
Stephen Chu



More information about the Qt-interest-old mailing list