fyanardi
5th June 2006, 17:27
Hi all,
I need to display a tiff image on a QWidget, the image is 8 bit-depth, and I need to represent it using 2 dimensional unsigned char so that it can be processed later. I've successfully read the tiff image into the char, but I can't draw it on the QWidget. What I've tried is:
unsigned char pic[512][512] = TiffIO::tiffReadPic("test.tif", pic, &width, &height);
QImage img(width, height,QImage::Format_Indexed8);
for(int i = 0; i < 255; i++)
{
myColor = qRgb(i, i, i);
img.setColor(i, myColor);
}
for(int i = 0; i<width; i++)
for(int j = 0; j<height; ++j)
img.setPixel(i, j, pic[i][j]);
But it doesn't give anything, the QWidget remains blank and no error message at all :(
Any suggestion?
Thanks...
I need to display a tiff image on a QWidget, the image is 8 bit-depth, and I need to represent it using 2 dimensional unsigned char so that it can be processed later. I've successfully read the tiff image into the char, but I can't draw it on the QWidget. What I've tried is:
unsigned char pic[512][512] = TiffIO::tiffReadPic("test.tif", pic, &width, &height);
QImage img(width, height,QImage::Format_Indexed8);
for(int i = 0; i < 255; i++)
{
myColor = qRgb(i, i, i);
img.setColor(i, myColor);
}
for(int i = 0; i<width; i++)
for(int j = 0; j<height; ++j)
img.setPixel(i, j, pic[i][j]);
But it doesn't give anything, the QWidget remains blank and no error message at all :(
Any suggestion?
Thanks...