|##########| |#MAGIC #|CLABLMHK |#PROJECT #|"" |#PATHS #|"StdProject" |#FLAGS #|xx-x-x-xx---x-x----------------- |#USERSW #|-------------------------------- |#USERMASK#|-------------------------------- |#SWITCHES#|xx---xxxxx------ |##########| DEFINITION MODULE GfxDraw; | | WB 26 May 1992 exceptions for correct and simple interface | | | this module implements an alternative interface to drawing and areafunctions | also found in Graphics plus some more functions to ease the programming. | Rastports have been replaced by screens, thus, this a screen-only module. | Success return values have been replaced by exceptions in the failurecase. | FROM System IMPORT BITSET,SHORTSET; FROM GfxScreen IMPORT Screen; EXCEPTION AreaDrawFail : "AreaDraw failed"; | Vektorliste voll AreaEllipseFail : "AreaEllipse failed"; | - " - AreaEndFail : "AreaEnd failed"; | - " - AreaMoveFail : "AreaMove failed"; | Vektorliste voll FloodFail : "Flood failed"; WritePixelFail : "WritePixel failed"; | pixel außerhalb screen TYPE Point = ARRAY [0..1] OF INTEGER; Polygon = ARRAY OF Point; DrawModes = (drawAPen,drawABPen,drawInvers); Pattern = ARRAY OF CARDINAL; PROCEDURE SetAPen(s : Screen;color : INTEGER); PROCEDURE SetBPen(s : Screen;color : INTEGER); PROCEDURE SetDrawMode(s : Screen;mode : DrawModes); PROCEDURE SetPlanes(s : Screen;plane : SHORTSET); PROCEDURE SetDrawPt(s : Screen;pat : CARDINAL); PROCEDURE SetAreaPt(s : Screen;VAR pat : Pattern); PROCEDURE ClearScreen(s : Screen); PROCEDURE WritePixel( s : Screen; x, y : INTEGER ); PROCEDURE ReadPixel( s : Screen;x,y : INTEGER ): INTEGER; PROCEDURE CursorX( s : Screen ): INTEGER; PROCEDURE CursorY( s : Screen ): INTEGER; PROCEDURE Move(s : Screen;x,y : INTEGER); PROCEDURE MoveTo(s : Screen;dx,dy : INTEGER); PROCEDURE Draw(s : Screen;x,y : INTEGER); PROCEDURE DrawTo(s : Screen;dx,dy : INTEGER); PROCEDURE Line(s : Screen;x1,y1,x2,y2 : INTEGER); PROCEDURE DrawRectangle(s : Screen;x1,y1,x2,y2 : INTEGER); PROCEDURE DrawPolygon(s : Screen;VAR poly : Polygon); PROCEDURE DrawCircle(s : Screen;x,y,r : INTEGER); PROCEDURE DrawEllipse(s : Screen;x,y,a,b : INTEGER); GROUP DrawGrp = Polygon, Screen, SHORTSET, Draw, DrawCircle, DrawEllipse, DrawPolygon, DrawRectangle, DrawTo, Line, Move, MoveTo, ReadPixel, SetAPen, SetAreaPt, SetBPen, SetDrawMode, SetDrawPt, SetPlanes, WritePixel; PROCEDURE AreaMove( s : Screen;x,y : INTEGER ); PROCEDURE AreaDraw(s : Screen;x,y : INTEGER); PROCEDURE AreaEnd( s : Screen ); PROCEDURE AreaRectangle(s : Screen;x1,y1,x2,y2 : INTEGER); PROCEDURE AreaPolygon(s : Screen;VAR poly : Polygon); PROCEDURE AreaCircle(s : Screen;x,y,r : INTEGER); PROCEDURE AreaEllipse(s : Screen;x,y,a,b : INTEGER); PROCEDURE Flood(s : Screen;x,y : INTEGER); GROUP ExceptionGrp = AreaDrawFail, AreaEllipseFail, AreaEndFail, AreaMoveFail, FloodFail, WritePixelFail; AreaGrp = AreaMoveFail, FloodFail, AreaEnd, AreaMove, AreaPolygon, AreaRectangle, Flood, SetAreaPt; All = DrawGrp, AreaGrp; END GfxDraw.