Reflecting a QPixmap ?

Charles Samuels charles at kde.org
Sun Aug 5 03:13:56 BST 2007


Clarence Dang wrote, on Saturday 2007 August 04:
> On Sunday 05 August 2007 04:02, John Tapsell wrote:
> >   Does anyone know if I can reflect a QPixmap, without doing the
> > horribly slow conversion to a QImage first?  I want to reflect a
> > QPixmap around the x-axis.  On my system it takes between 20ms to
> > 100ms to use transformation.
>
> I think QPainter::setMatrix() followed by QPainter::drawPixmap() will do
> it.

I'm going to venture a guess and say that QPainter will internally convert to 
a QImage first for this.

> I was going to suggest QPixmap::transformed(), which I currently use for
> flipping but then I read that it "is slow because it involves
> transformation to a QImage, non-trivial computations and a transformation
> back to a QPixmap" [http://doc.trolltech.com/4.3/qpixmap.html#transformed].
>  If this is really true, I'll simply switch my code to use QPainter
> instead.

And this too. :)

I think the best way for you, John, is to do a bitBlt on each row of pixels, 
manually.

Charles




More information about the kde-core-devel mailing list