Understanding QPainterPath::simplified()
Hello.
My implementation of 'paintEvent' is giving a particular result:
Code:
{
p.
setBrush( QBrush( Qt
::gray ) );
myPath.moveTo( 600.0, 250.0 );
myPath.cubicTo( 90.0, 50.0, 0.0, 50.0, 50.0, 370.0 );
myPath.cubicTo( 140.0, 20.0, 10.0, 10.0, 600.0, 250.0 );
myPath.addRect( 10.0, 300.0, 160.0, 34.0 );
p.drawPath( result );
}
Looking like this:
http://s7.postimg.org/3s67tyfwb/painter_Path.png
Shouldn't the intersected region between the rectangle and the bezier path be filled in the path generated by the 'simplified' call?
Re: Understanding QPainterPath::simplified()
What fill mode do you have set on the path?
Re: Understanding QPainterPath::simplified()
Hello.
I'm using WindingFill, but in any case I tested with either of the fill modes and the result is the same.
According to some more research, QPainterPath::simplified will output a path that looks the same as the original when painted.
So for "moveTo" elements like that rectangle I can create a temporary path and then unite both as a boolean operation.
Additionally, QPainterPath::simplified will convert that path which originally has 7 elements into a 145 "lineTo" elements path that is an approximation, so it won't work for what I want.
This is the result from QPainterPath::simplified:
http://s15.postimg.org/gp8t6acnv/painter_Path2.png
I'll try something with a computational geometry library, and then feed the results back to Qt for rendering.