Page 1 of 1

StrokePath flag: #PB_Path_EndCapArrow

Posted: Thu Sep 22, 2016 1:51 am
by netmaestro
So we can have a nice arrow capping our arc without calculating angles and positions and doing it the long way. I actually assumed this was already in there until I went to use it - "..and when he got there, the cupboard was bare."

Re: StrokePath flag: #PB_Path_EndCapArrow

Posted: Thu Sep 22, 2016 2:15 am
by freak
This would not work on all platforms.

Re: StrokePath flag: #PB_Path_EndCapArrow

Posted: Thu Sep 22, 2016 2:33 am
by netmaestro
I see. However, seeing how easily it can be implemented "the long way", could it not wrap gdiplus on windows and then do it the long way on platforms with no corresponding functionality? My manual attempt produces output that looks identical to that of the gdiplus version. No rush, it wouldn't be a priority at all.

Re: StrokePath flag: #PB_Path_EndCapArrow

Posted: Thu Sep 22, 2016 4:08 am
by freak
Such manual implementations are a headache to get to behave in the exact same way as a native one. This usually leads to lots of bug reports and corrections that need to be made down the line. The devil is in the details in such a case. I have learned this the hard way and therefore try to avoid this whenever possible.

For example: If you look closely at the output of your code, you will notice a slight "gap" between the line and the arrow depending on the angle (this is due to the antialiasing of the edges). There is also different behavior in case the arrow overlaps with the path.

As you demonstrated, it is easy enough to do the manual way if you can live with those limitations. However, a library implementation is held to a higher standard than that.

Re: StrokePath flag: #PB_Path_EndCapArrow

Posted: Thu Sep 22, 2016 4:57 am
by netmaestro
Sure, fair enough. Thanks for the investigation, it's appreciated.