ich versuche gerade Pixel in einem 8Bit QImage Objekt, zu manipulieren.
Dabei habe ich das Problem das die Pixel nicht manipuliert werden und beim abspeichern ein "Segmention fault" Fehler auftritt. Nun frage ich mich woran das liegt. Hier mal der code
Code: Alles auswählen
QVector<QRgb> vcolorTable;
QRgb *colorTable = new QRgb[256];
m_Image = QImage(400, 400, QImage::Format_Indexed8);
for (int i = 0; i < 256; i++) {
colorTable[i] = qRgb(i, i, i);
vcolorTable[i] = colorTable[i];
}
m_Image.setColorTable(vcolorTable);
for (int j=0; j < 200; j++)
for ( int i=0; i < 400; i++)
*(m_Image.scanLine(j) + i) = (uchar) 0;
m_Image.save("bild.bmp");
Gruß
Treehouse