how to draw a image of size 600x400
hi,
can anyone say me how to draw an image of size 600x400. i tried as follows
Code:
uint x,y;
x=550;
y=500;
image.setAlphaBuffer( true );
for ( uint j =0; j <x; j++ )
{
for ( uint i =0; i <y; i++ )
{
QRgb pixel;
pixel = qRgb(0,0,255);
image.setPixel( i, j, pixel );
}
}
p.
drawImage(QPoint(0,
0),image,
0);
when i executed this it said the following error:
"
QImage::scanLine: Index 500 out of range
Segmentation fault ".
but i can succesfuly draw an image of size 500x500.
can anyone say me why is that so ..
thanks in advance,
saravanan
Re: how to draw a image of size 600x400
Hi,
seems to that you have to swap i and j:
Code:
image.setPixel( j, i, pixel );
Lykurg
EDIT: or you must say j<y and i<x.
Re: how to draw a image of size 600x400
hi,
thank you for the reply.now i got it working.