Reflecting a QPixmap ?

Lubos Lunak l.lunak at suse.cz
Mon Aug 6 15:12:43 BST 2007


On Sunday 05 of August 2007, John Tapsell wrote:
> 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 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?

 No. Pixmap to pixmap bitblt can be done in the X server, so if you just copy 
rows into their new positions that should be without a conversion to QImage, 
which is otherwise needed for actually accessing the pixels. I have no better 
idea for this, the only other option is see is using XRender, which can have 
a transformation matrix, but I think XRender is an ancient african word 
meaning "slow" :-/.

-- 
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o.   e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http//www.suse.cz




More information about the kde-core-devel mailing list