33{
36
38
39 if (size == 0) {
41 }
42
43 int maxDim = qMax(rc.width(), rc.height());
44
45
46
47 const qreal margin = 0.05;
48
49 QImage image(size, size, QImage::Format_ARGB32_Premultiplied);
50 qreal symbolScale = (qreal)(size*(1.0 - 2*margin))/maxDim;
51 QPainter gc(&image);
52 gc.setRenderHint(QPainter::Antialiasing, true);
53 image.fill(Qt::gray);
54
55
56
57
58 gc.translate(size*margin, size*margin);
59 gc.scale(symbolScale, symbolScale);
60 gc.translate(-rc.x(), -rc.y());
61
62 gc.translate((maxDim - rc.width())/2.0, (maxDim - rc.height())/2.0);
64 gc.end();
65 return image;
66}
QRectF boundingRect() const override
a group's boundingRect
static void renderSingleShape(KoShape *shape, QPainter &painter)
renderSingleShape renders a shape on painter. This method includes all the needed steps for painting ...
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
int size(const Forest< T > &forest)