Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, August 2006
Q4 QPainter - drawing a pixmap, ignoring the alpha channel


Message 1 in thread

I have a QImage with an embedded alpha channel. When the embedded alpha 
channel contains all black, and I convert it to a QPixmap for display, 
nothing is drawn when I paint the pixmap.

Is there a way to paint the image/pixmap with the painter ignoring the 
alpha channel? I just want it to render the RGB channels, and assume 
alpha is opaque.

-- 
 [ signature omitted ] 

Message 2 in thread

Paul Miller wrote:

> I have a QImage with an embedded alpha channel. When the embedded alpha
> channel contains all black, and I convert it to a QPixmap for display,
> nothing is drawn when I paint the pixmap.
> 
> Is there a way to paint the image/pixmap with the painter ignoring the
> alpha channel? I just want it to render the RGB channels, and assume
> alpha is opaque.

You could use QImage::convertToFormat(QImage::Format_RGB32) to obtain a
new image without the alpha channel.

-- 
 [ signature omitted ]