void ScribbleArea::drawGrid()
{
painter.
setPen(QPen(myPenColor, myPenWidth, Qt
::SolidLine, Qt
::RoundCap,
Qt::RoundJoin));
for(int y=0; y<image.height(); y+=gridSize)
for(int x=0; x<image.width(); x+=gridSize)
painter.drawPoint(x,y);
}
void ScribbleArea::drawPolygon()
{
painter.
setPen(QPen(myPenColor, myPenWidth, Qt
::SolidLine, Qt
::RoundCap,
Qt::RoundJoin));
#if 0
drawGrid();
#else
for(int y=0; y<image.height(); y+=gridSize)
for(int x=0; x<image.width(); x+=gridSize)
painter.drawPoint(x,y);
#endif
painter.drawLine(myPolygon);
modified = true;
}
void ScribbleArea
::paintEvent(QPaintEvent * /* event */) {
painter.
drawImage(QPoint(0,
0), image
);
}
void ScribbleArea::drawGrid()
{
QPainter painter(&image);
painter.setPen(QPen(myPenColor, myPenWidth, Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
for(int y=0; y<image.height(); y+=gridSize)
for(int x=0; x<image.width(); x+=gridSize)
painter.drawPoint(x,y);
}
void ScribbleArea::drawPolygon()
{
QPainter painter(&image);
painter.setPen(QPen(myPenColor, myPenWidth, Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
#if 0
drawGrid();
#else
for(int y=0; y<image.height(); y+=gridSize)
for(int x=0; x<image.width(); x+=gridSize)
painter.drawPoint(x,y);
#endif
painter.drawLine(myPolygon);
modified = true;
}
void ScribbleArea::paintEvent(QPaintEvent * /* event */)
{
QPainter painter(this);
painter.drawImage(QPoint(0, 0), image);
}
To copy to clipboard, switch view to plain text mode
Bookmarks