StrokePath flag: #PB_Path_EndCapArrow

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

StrokePath flag: #PB_Path_EndCapArrow

Post 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."
BERESHEIT
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: StrokePath flag: #PB_Path_EndCapArrow

Post by freak »

This would not work on all platforms.
quidquid Latine dictum sit altum videtur
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: StrokePath flag: #PB_Path_EndCapArrow

Post 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.
BERESHEIT
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: StrokePath flag: #PB_Path_EndCapArrow

Post 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.
quidquid Latine dictum sit altum videtur
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: StrokePath flag: #PB_Path_EndCapArrow

Post by netmaestro »

Sure, fair enough. Thanks for the investigation, it's appreciated.
BERESHEIT
Post Reply