[Qt-interest] QImage fade

Sean Harmer sean.harmer at maps-technology.com
Sat May 7 17:08:59 CEST 2011


Hi,

On Saturday 07 May 2011 07:33:41 Joshua Grauman wrote:
> Mihail,
> 
> Thanks for the suggestion. I've tried multiple times to do this directly
> with QPainter and as far as I can tell it isn't possible directly (at
> least not without extra deep copies of the entire QImage). If someone has
> a direct way to do this with QPainter, I'd love to see it! Thanks.

Are you trying to display the fading image in real-time? If so, then I would 
suggest that you use OpenGL. Just draw 2 textured triangles for each image 
such that they form a rectangle.

Draw one image, then overlay the second image over it with a suitable blend 
function, glBlendFunction(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA) say. 

Then each frame vary the alpha of the second image from 0 up to 1.

Google around for "OpenGL fade" and you'll find plenty of resources to help 
you do this plus other related things like fading in/out to black etc.

HTH,

Sean




More information about the Qt-interest-old mailing list