PDA

View Full Version : QImage.pixel and Format_Indexed8



chef_seppel
29th September 2010, 15:08
Hi,

i got a Problem (surprise! :)

when I execute this code:



QImage image1(10, 10, QImage::Format_Indexed8);
QImage image2(10, 10, QImage::Format_Indexed8);

image1.fill(0);
image2.fill(1);

image2.setPixel(1,1, image1.pixel(1,1));


I get this:

ASSERT failure in QVector<T>::at: "index out of range", file c:\iwmake\build_vs2008_opensource_________________ padding_________________\include\qtcore\../../src/corelib/tools/qvector.h, line 338

the weird thing is that i can access the imagedata via .bits. I can also show it in an QGraphicsScene....

But why do the pixel und setpixel functions crash?

thanks
chef_seppel

franco.amato
29th September 2010, 22:43
But why do the pixel und setpixel functions crash?

thanks
chef_seppel

is the pixel or setPixel that crashes?

wysota
29th September 2010, 23:17
I think you have to set a colour table on an indexed image before you start manipulating its pixels.