#include <QImage>
#include <QPainter>
int main()
{
// size of square Image
const int nSize = 100;
// create monochrome Image
pnt.begin(&img);
// fill background with white
pnt.fillRect(0, 0, nSize, nSize, Qt::color0);
pnt.
setPen(QPen(Qt
::color1));
// draw a rectangle
pnt.drawRect(0, 0, nSize-1, nSize-1);
pnt.end();
img.save("original.bmp");
// rotate image
m.rotate(45);
img = img.transformed(m);
img.save("rotated.bmp");
return 0;
}
#include <QImage>
#include <QPainter>
int main()
{
// size of square Image
const int nSize = 100;
// create monochrome Image
QImage img = QImage(nSize, nSize, QImage::QImage::Format_Mono);
QPainter pnt;
pnt.begin(&img);
// fill background with white
pnt.fillRect(0, 0, nSize, nSize, Qt::color0);
pnt.setPen(QPen(Qt::color1));
// draw a rectangle
pnt.drawRect(0, 0, nSize-1, nSize-1);
pnt.end();
img.save("original.bmp");
// rotate image
QMatrix m;
m.rotate(45);
img = img.transformed(m);
img.save("rotated.bmp");
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks