Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QPainter, QPixmap, drawPie and Transformations
I have a PNG image which I've loaded into my application as a
What I'm looking to do is to stretch this image into the shape of a pie slice and draw it using the
Having loaded a new
QBrushinstance with the
QPixmap, I now need to somehow transform the brush to the shape of the pie.
Any clues as to how this may be achieved? Thank you in advance for any hints
DrawPie will use any brush set to fill the pie.
I assume you want it filled other than how brush does ?
@mrjj You are indeed correct - I want the brush to be
transformedso that the
QPixmapis adjusted to fill the interior of the pie, assuming the shape of the pie.
It does have
void QBrush::setTransform(const QTransform & matrix)
but its unclear how you mean it should be draw since
it does brush does fill the interior but will do so in a reaping manner.
@mrjj Sorry, I'm not explaining this very well...
Imagine the point of the pie slice. The bitmap should be drawn such that the pixels on the bottom row are squashed into this point. Then imagine the curve of the pie slice, the top row of the bitmap (and nearby pixels) would be stretched and transformed to fit in the curve.
All other pixels within the bitmap would also be transformed to fill the remaining area of the pie slice.
Does that make any sense at all :)
Hmm i think i get it now, like a perfect fit for the pixmap
and not just filled as repeating fill.