int main(int argc, char *argv[]){
int height = 500;
int width = 600;
myPainter.translate(0,height);
//make the coordinate system look like this:
// -y ^
// |
// |
// |
// |
// ----------->
// 0,0 +x
QRectF myRect
( 100.001,
-100, width
-200,
-(height
-200) );
//**here lies the problem, I guess myPainter.setClipRect(myRect, Qt::ReplaceClip);
myPainter.fillRect(0, 0, width, -height, Qt::cyan);
myPainter.setClipRect(myRect, Qt::NoClip);
myPixmap.save("out.png", "PNG");
return 0;
}
int main(int argc, char *argv[]){
QApplication app(argc, argv);
int height = 500;
int width = 600;
QPixmap myPixmap(width, height);
QPainter myPainter(&myPixmap);
myPainter.translate(0,height);
//make the coordinate system look like this:
// -y ^
// |
// |
// |
// |
// ----------->
// 0,0 +x
QRectF myRect( 100.001, -100, width-200, -(height-200) ); //**here lies the problem, I guess
myPainter.setClipRect(myRect, Qt::ReplaceClip);
myPainter.fillRect(0, 0, width, -height, Qt::cyan);
myPainter.setClipRect(myRect, Qt::NoClip);
myPixmap.save("out.png", "PNG");
return 0;
}
To copy to clipboard, switch view to plain text mode
QRectF myRect
( 100,
-100, width
-200,
-(height
-200) );
QRectF myRect( 100, -100, width-200, -(height-200) );
To copy to clipboard, switch view to plain text mode
the image is entirely black...
Bookmarks