Reflecting a QPixmap ?

John Tapsell johnflux at gmail.com
Sun Aug 5 10:11:27 BST 2007


On 05/08/07, Charles Samuels <charles at kde.org> wrote:
> 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.

Yes, it does appear so.  I tried this and it takes just as long to draw.


> > 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.

Hmm - I still need to convert to a QImage and back again right?


John




More information about the kde-core-devel mailing list