Hi,
I am relatively new to Qt programming. I have hit a dead end and seek help.
I am running Qt in Linux.
Following is my code -
painter.begin(&rcptImage);
QImage::Format f
= img.
format();
printf("%d\n", f);
uchar* tempData = img.bits();
QImage::Format f1
= img1.
format();
painter.
drawImage(QPoint(10,
10), img1
);
painter.end();
rcptImage.save("/home/chaitras/output1.bmp");
QPainter painter;
QImage rcptImage(216, 560, QImage::Format_Mono);
painter.begin(&rcptImage);
QImage img("./test1.bmp");
QImage::Format f = img.format();
printf("%d\n", f);
uchar* tempData = img.bits();
QImage img1(img.bits(), 320, 240, QImage::Format_Mono);
QImage::Format f1 = img1.format();
painter.drawImage(QPoint(10,10), img1);
painter.end();
rcptImage.save("/home/chaitras/output1.bmp");
To copy to clipboard, switch view to plain text mode
Program is crashing at "painter.drawImage(QPoint(10,10), img1);"
test1.bmp is a 1bpp image - 360 x 260 x 1. Attached the image.
I am trying to reading the bits from "img" and create a new image img1 using these bits.
And using img1, which results in a crash.
Stacktrace is pointing to a function "convertIndexedToARGB32PM Line 95"
convertIndexedToARGB32PM Line 95
blend_untransformed_generic Line 4264
fillRect_normalized Line 1491
QRasterPaintEngine::drawImage Line 2187
QPainter::drawImage Line 5356
QPainter::drawImage qpainter.h Line 852
main
Any help on this would be appreciated.
Bookmarks