PDA

View Full Version : negative images



tommy
19th January 2008, 22:31
How do you convert QImage and QPixmap (that are grayscale) to negative mode? Is there a function for that?

ashukla
20th January 2008, 04:39
How do you convert QImage and QPixmap (that are grayscale) to negative mode? Is there a function for that?
What Do you mean by negative mode?

wysota
20th January 2008, 11:18
You have to negate each pixel in the image or negate each colour in the lookup table (depending on the mode of the image). To negate a grayscale color, you can use
int v = 255-qGray(color.rgb());
QColor result = QColor(v,v,v);

aamer4yu
22nd January 2008, 10:41
Or you can use QImage::invertPixels :)