[Qt-interest] Alpha channel masking for non-image QGraphicsItem?

Stephen Chu stephen at ju-ju.com
Thu Feb 18 00:57:17 CET 2010


Is there a way to use an 8-bit image as alpha channel for a non-image 
item?

The 8-bit image is read from the disk and contains the typical grayscale 
image acting as alpha channel for some drawing. This graphics item is on 
top of other items and needs to be painted through the soft mask.

The only way I can think of right now is to use a QImage and set the 
pixmap as alpha channel to it then use the QImage as a painter to draw 
the real item. But setAlphaChannel is now obsolete. And creating a 
QImage just for some simple painting seems less than optimal in both 
speed and memory usage.

Any suggestions are appreciated.

-- 
Stephen Chu



More information about the Qt-interest-old mailing list