From 508f1229169dd298346dade8357e8db93313740f Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 23 Oct 2005 01:05:01 +0000 Subject: Added fields to indicate size of objects --- vectorgfx.mod/vectorgfx.bmx | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/vectorgfx.mod/vectorgfx.bmx b/vectorgfx.mod/vectorgfx.bmx index dc84388..57df6ee 100644 --- a/vectorgfx.mod/vectorgfx.bmx +++ b/vectorgfx.mod/vectorgfx.bmx @@ -221,6 +221,30 @@ Type TVectorGfxObject EndRem Field y:Int Rem + bbdoc: The minimum X co-ordinate of the object. Only valid after a call to SetPoints(). + EndRem + Field min_x:Int + Rem + bbdoc: The maximum X co-ordinate of the object. Only valid after a call to SetPoints(). + EndRem + Field max_x:Int + Rem + bbdoc: The minimum Y co-ordinate of the object. Only valid after a call to SetPoints(). + EndRem + Field min_y:Int + Rem + bbdoc: The maximum Y co-ordinate of the object. Only valid after a call to SetPoints(). + EndRem + Field max_y:Int + Rem + bbdoc: The width of the object. Only valid after a call to SetPoints(). + EndRem + Field width:Int + Rem + bbdoc: The height of the object. Only valid after a call to SetPoints(). + EndRem + Field height:Int + Rem bbdoc: The angle of the object, as degrees*10. Must be within the range 0-3599 inclusive. EndRem Field ang:Int @@ -241,6 +265,12 @@ Type TVectorGfxObject rotated=Null x=0 y=0 + min_x=9999999 + min_y=9999999 + max_x=-9999999 + max_y=-9999999 + width=0 + height=0 ang=0 scale=1 End Method @@ -253,6 +283,12 @@ Type TVectorGfxObject Local o:TVectorGfxObject=New TVectorGfxObject o.x=x o.y=y + o.min_x=min_x + o.min_y=min_y + o.max_x=max_x + o.max_y=max_y + o.width=width + o.height=height o.ang=ang o.scale=scale o.SetPoints(points) @@ -268,7 +304,13 @@ Type TVectorGfxObject points=New TVectorGfxPoint[pa.length] For Local f:Int=0 Until pa.length points[f]=TVectorGfxPoint(pa[f]) + min_x=Min(min_x,points[f].x) + min_y=Min(min_y,points[f].y) + max_x=Max(max_x,points[f].x) + max_y=Max(max_y,points[f].y) Next + width=max_x-min_x + height=max_y-min_y End Method Rem -- cgit v1.2.3