Han-Create Rectangle
From Vectorlab
Creates a rectangle and returns a handle to it. If a diameter is defined (diamX, diamX) the rectangle will draw as rounded rectangle. This fixes a bug where RRects by negative width or height values draw as plain Rect by VW 13 and 14 SP1. By Orso B. Schmid
{ Orso *********************************************** } { fix bug where RRects by negative width or height vals the RRect draws as Rect } { by VW 13 and 14 SP1 } FUNCTION H_Rect(strtPtX, strtPtY, theWidth, theHeight, ang, diamX, diamY: REAL): HANDLE; VAR v : VECTOR; angRad: REAL; FUNCTION OffsetPt(p : VECTOR; dist, ang: REAL): VECTOR; BEGIN OffsetPt := p + (Ang2Vec(ang, 1) * dist); END; BEGIN v.x := strtPtX; v.y := strtPtY; angRad := Deg2Rad(ang); IF ((diamX=0) & (diamY=0)) THEN RectangleN(strtPtX, strtPtY, Cos(angRad), Sin(angRad), theWidth, theHeight) ELSE BEGIN IF (theWidth < 0) THEN v := OffsetPt(v, theWidth, -ang); IF (theHeight < 0) THEN v := OffsetPt(v, -theHeight, -90+ang); RRectangleN(v.x, v.y, Cos(angRad), Sin(angRad), Abs(theWidth), Abs(theHeight), diamX, diamY); END; H_Rect := LNewObj; END;
