Reputation: 95
I am using qt for developing a simple drawing application.
I have a qImage and filled it as trasparent.
QImage *m_markerImg = new QImage(400,320, QImage::Format_ARGB32_Premultiplied);
m_markerImg -> fill( Qt::transparent );
I have created a custom graphics scene by inheriting it from qgraphicsscene & drawing a line on this image in the mousemove event of graphics scene as:
QPointF plotPoint = mouseEvent->scenePos();
m_painter.drawLine(m_initPoint,plotPoint);
m_initPoint=plotPoint;
where m_initPoint is being assigned in mouse press event. Everything is working fine and i am able to draw lines over this image. Now i want to store the pixels covered by this line at runtime i.e. during line draw. Although i can store the points on which i am drawing i.e. m_initPoint & plotPoint but in case of penwidth is set to more than 1 , then i will get only a single line pixel while i need whole of the pixels covered by the width of this line.
How can i get that?
Upvotes: 1
Views: 520
Reputation: 98425
You need to:
QPainterPathStroker
(see also this example),Upvotes: 0