[Qt-interest] How to invert colors in QGraphicsPixmapItem

Anthony Serdyukov uksus70 at gmail.com
Wed Dec 24 06:04:02 CET 2008


Hello.

I have QGraphicsPixmapItem and a pixmap loaded into it.
User can toggle an "Invert" button and the image should invert its colors.

Now I accomplish the task like this:

QImage image = item->pixmap().toImage();
image.invertPixels();
item->setPixmap(QPixmap::fromImage(image));

But can I do this without conversions to/from QImage?

-- 
Regards,
Anthony



More information about the Qt-interest-old mailing list