Change the result of Box() that uses negative dimensions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Change the result of Box() that uses negative dimensions

Post by Demivec »

The 2D_Drawing library was modfied in one of the recent versions (v4.40 I believe) to prevent lines and boxes being drawn if their widths or heights were zero. This was a great improvement. This resulted in some quirky functioning with the Box() function.

When it is specified as Box(x, y, width, height) the point(x,y) is not part of the box if either the width or height is less than zero. See this forum url=http://www.purebasic.fr/english/viewtop ... 13&t=42599]thread[/url].

Also included in that thread is a suggested fix which can be restated this way. Before drawing the box, the starting point's x coordinate be adjusted by adding 1 if the width is negative and the starting point's y be adjusted by adding 1 if the height is negative. This would cause the box to include the specified starting point and also be the proper width and height.

I realize things may be the way they are currently to keep the drawing functions fast. However this does not seem a complex change and it would remedy the illogical result of a box not being drawn with the starting point that was specified. :wink: