sar_van81
2nd February 2007, 05:01
hi...
i have a problem with QImage.setPixel() function. i used it as follows:
QImage img(100,100,32);
for (int i = 0; i <x; i++ )
{
for (int j = 0; j <y; j++ )
{
QRgb pixel;
pixel = qRgb(255,0,255);
image.setPixel( i, j, pixel );
}
}
. when i draw this image using painter. it plots the colour in the pixel.this is fine,but when i give rgb values from a buffer. it does not draw well. i did is this: i opened a BMP file read only the RGB datas (reading the image after 54 bytes.i.e after the headers ). i store them in an array. when i feed them to the qRgb function and draw image, the pixel values are not alligned propeerly.there is a offset between the each row.also the image
is rotated right.
can anyone say me why is this..? i used the same function and same for loop.but only the values are different.Instead of a particular RGB value, i give it from a buffer.
am i missing something else ...? is this correct way..?
thanks in advance
i have a problem with QImage.setPixel() function. i used it as follows:
QImage img(100,100,32);
for (int i = 0; i <x; i++ )
{
for (int j = 0; j <y; j++ )
{
QRgb pixel;
pixel = qRgb(255,0,255);
image.setPixel( i, j, pixel );
}
}
. when i draw this image using painter. it plots the colour in the pixel.this is fine,but when i give rgb values from a buffer. it does not draw well. i did is this: i opened a BMP file read only the RGB datas (reading the image after 54 bytes.i.e after the headers ). i store them in an array. when i feed them to the qRgb function and draw image, the pixel values are not alligned propeerly.there is a offset between the each row.also the image
is rotated right.
can anyone say me why is this..? i used the same function and same for loop.but only the values are different.Instead of a particular RGB value, i give it from a buffer.
am i missing something else ...? is this correct way..?
thanks in advance