home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1985-04-25 | 10.6 KB | 297 lines |
- (*===================================================================*)
- DEFINITION MODULE QuickDraw; (* Franz Kronseder 07.12.84 *)
- (* last modification 06.02.85 *)
- FROM SYSTEM IMPORT ADDRESS,WORD;
-
- EXPORT QUALIFIED (* constants *)
- srcCopy, srcOr, srcXor, srcBic,
- notSrcCopy, notSrcOr, notSrcXor, notSrcBic,
- patCopy, patOr, patXor, patBic,
- notPatCopy, notPatOr, notPatXor, notPatBic,
-
- (* simple and ARRAY-types *)
- QDHandle, Pattern, Bits16 , VHSelect,GrafVerb,StyleItem, Style,
-
- (* structured record types *)
- FontInfo , Point ,Rect ,BitMap , Cursor, PenState ,RgnHandle,
- RgnPtr ,Region, PicHandle, PicPtr, Picture, PolyHandle, PolyPtr,
- Polygon, QDProcsPtr , QDProcs , GrafPtr,GrafPort, Str255,
-
- (* QuickDraw global Variables
- thePort, screenBits,randSeed,
- white,black ,gray,ltGray,dkGray ,arrow, *)
-
- (* GrafPort Routines *)
- InitGraf,OpenPort,InitPort,ClosePort,SetPort,GetPort,
- GrafDevice,SetPortBits,PortSize,MovePortTo,SetOrigin,
- SetClip,GetClip,ClipRect,BackPat,
-
- (* Cursor Routines *)
- InitCursor,SetCursor,HideCursor, ShowCursor,ObscureCursor,
-
- (* Line Routines *)
- HidePen,ShowPen,GetPen,GetPenState,SetPenState,PenSize,
- PenMode,PenPat,PenNormal,MoveTo,Move,LineTo,Line,
-
- (* Text Routines *)
- TextFont,TextFace,TextMode,TextSize,SpaceExtra,DrawChar,
- DrawString,DrawText,CharWidth,StringWidth,TextWidth,
- GetFontInfo,TextBox,
-
- (* Graphical Operations on Rectangles *)
- FrameRect,PaintRect,EraseRect,InvertRect,FillRect,
-
- (* Graphical Operations on BitMaps *)
- ScrollRect,CopyBits,
-
- (* Region Operations *)
- NewRgn,DisposeRgn,CopyRgn,SetEmptyRgn,SetRectRgn,
- FrameRgn,PaintRgn,EraseRgn,InvertRgn,FillRgn;
-
-
- (*--------------------------------------------- *)
- TYPE LONGINT = ADDRESS ; (* 32 bits *)
-
- (* these definitions come from the MacIntosh Interface files
- on the Lisa Workshop Supplement for the MAC. Copyright 1983 Apple Computer Inc. *)
-
- (* the 16 transfer modes *)
- CONST
- srcCopy = 0; srcOr = 1; srcXor = 2; srcBic = 3;
- notSrcCopy = 4; notSrcOr = 5; notSrcXor = 6; notSrcBic = 7;
- patCopy = 8; patOr = 9; patXor = 10; patBic = 11;
- notPatCopy = 12; notPatOr = 13; notPatXor = 14; notPatBic = 15;
-
- (* QuickDraw color separation constants *)
- normalBit =0; inverseBit =1; redBit =4; greenBit =3;
- blueBit =2; cyanBit =8; magentaBit =7; yellowBit =6;
- blackBit =5;
- (* normal screen mapping inverse screen mapping *)
- (* RGB additive mapping CMYBk subtractive mapping *)
- (* colors expressed in these mappings *)
- blackColor = 33; whiteColor = 30;
- redColor = 205; greenColor = 341;
- blueColor = 409; cyanColor = 273;
- magentaColor = 137; yellowColor = 69;
-
- picLParen =0; picRParen =1; (* standard picture comments *)
-
- TYPE QDHandle = POINTER TO ADDRESS; (* blind handle *)
- Str255 = ARRAY [0..255] OF CHAR; (* Pascal compatible String *)
- Pattern = ARRAY[0..7] OF [0..255];
- Bits16 = ARRAY[0..15] OF INTEGER;
- VHSelect = (v,h);
- GrafVerb = (frame,paint,erase,invert,fill);
- StyleItem = (bold,italic,underline,outline,shadow,condense,extend);
- Style = SET OF StyleItem;
-
- FontInfo = RECORD
- ascent: INTEGER; descent: INTEGER;
- widMax: INTEGER; leading: INTEGER; END;
-
- Point = RECORD CASE INTEGER OF
- 0: v: INTEGER;h: INTEGER;
- | 1: vh: ARRAY VHSelect OF INTEGER; END END;
-
- Rect = RECORD CASE INTEGER OF
- 0: top: INTEGER;
- left: INTEGER;
- bottom: INTEGER;
- right: INTEGER;
- | 1: topLeft: Point; botRight: Point; END END;
-
-
- BitMap = RECORD
- baseAddr: ADDRESS;
- rowBytes: INTEGER;
- bounds: Rect; END;
-
-
- Cursor = RECORD
- data: Bits16; mask: Bits16;
- hotSpot: Point; END;
-
-
- PenState = RECORD
- pnLoc: Point;
- pnSize: Point;
- pnMode: INTEGER;
- pnPat: Pattern;
- END;
-
- RgnHandle = POINTER TO RgnPtr;
- RgnPtr = POINTER TO Region;
- Region = RECORD
- rgnSize: INTEGER; (* rgnSize = 10 for rectangular *)
- rgnBBox: Rect;
- (* plus more data if not rectangular *)
- END;
-
- PicHandle = POINTER TO PicPtr;
- PicPtr = POINTER TO Picture;
- Picture = RECORD
- picSize: INTEGER;
- picFrame: Rect; (* picture definition data *)
- END;
-
- PolyHandle = POINTER TO PolyPtr;
- PolyPtr = POINTER TO Polygon;
- Polygon = RECORD
- polySize: INTEGER;
- polyBBox: Rect;
- polyPoints: ARRAY [0..0] OF Point
- END;
-
- QDProcsPtr = POINTER TO QDProcs;
- QDProcs = RECORD
- textProc: ADDRESS;
- lineProc: ADDRESS;
- rectProc: ADDRESS;
- rRectProc: ADDRESS;
- ovalProc: ADDRESS;
- arcProc: ADDRESS;
- polyProc: ADDRESS;
- rgnProc: ADDRESS;
- bitsProc: ADDRESS;
- commentProc: ADDRESS;
- txMeasProc: ADDRESS;
- getPicProc: ADDRESS;
- putPicProc: ADDRESS;
- END;
-
-
- GrafPtr = POINTER TO GrafPort;
- GrafPort = RECORD
- device: INTEGER;
- portBits: BitMap;
- portRect: Rect;
- visRgn: RgnHandle;
- clipRgn: RgnHandle;
- bkPat: Pattern;
- fillPat: Pattern;
- pnLoc: Point;
- pnSize: Point;
- pnMode: INTEGER;
- pnPat: Pattern;
- pnVis: INTEGER;
- txFont: INTEGER;
- txFace: Style;
- txMode: INTEGER;
- txSize: INTEGER;
- spExtra: LONGINT;
- fgColor: LONGINT;
- bkColor: LONGINT;
- colrBit: INTEGER;
- patStretch: INTEGER;
- picSave: QDHandle;
- rgnSave: QDHandle;
- polySave: QDHandle;
- grafProcs: QDProcsPtr;
- END;
-
- (*
- VAR thePort: GrafPtr;
- white: Pattern;
- black: Pattern;
- gray: Pattern;
- ltGray: Pattern;
- dkGray: Pattern;
- arrow: Cursor;
- screenBits: BitMap;
- randSeed: LONGINT; these variables exist already in surrounding Loader Environment *)
-
-
- (* GrafPort Routines *)
- PROCEDURE InitGraf (globalPtr: ADDRESS);
- (* Note-kept as external for compiler *)
- PROCEDURE OpenPort (port: GrafPtr);
- PROCEDURE InitPort (port: GrafPtr);
- PROCEDURE ClosePort (port: GrafPtr);
- PROCEDURE SetPort (port: GrafPtr);
- PROCEDURE GetPort (VAR port: GrafPtr);
- PROCEDURE GrafDevice (device: INTEGER);
- PROCEDURE SetPortBits(VAR bm: BitMap);
- PROCEDURE PortSize (width,height: INTEGER);
- PROCEDURE MovePortTo (leftGlobal,topGlobal: INTEGER);
- PROCEDURE SetOrigin (h,v: INTEGER);
- PROCEDURE SetClip (rgn: RgnHandle);
- PROCEDURE GetClip (rgn: RgnHandle);
- PROCEDURE ClipRect (VAR r: Rect);
- PROCEDURE BackPat (VAR pat: Pattern);
-
-
- (* Cursor Routines *)
- PROCEDURE InitCursor;
- PROCEDURE SetCursor(VAR crsr: Cursor);
- PROCEDURE HideCursor;
- PROCEDURE ShowCursor;
- PROCEDURE ObscureCursor;
-
-
- (* Line Routines *)
- PROCEDURE HidePen;
- PROCEDURE ShowPen;
- PROCEDURE GetPen (VAR pt: Point);
- PROCEDURE GetPenState(VAR pnState: PenState);
- PROCEDURE SetPenState(VAR pnState: PenState);
- PROCEDURE PenSize (width,height: INTEGER);
- PROCEDURE PenMode (mode: INTEGER);
- PROCEDURE PenPat (VAR pat: Pattern);
- PROCEDURE PenNormal;
- PROCEDURE MoveTo (h,v: INTEGER);
- PROCEDURE Move (dh,dv: INTEGER);
- PROCEDURE LineTo (h,v: INTEGER);
- PROCEDURE Line (dh,dv: INTEGER);
-
-
- (* Text Routines *)
- PROCEDURE TextFont (font: INTEGER);
- PROCEDURE TextFace (face: Style);
- PROCEDURE TextMode (mode: INTEGER);
- PROCEDURE TextSize (size: INTEGER);
- PROCEDURE SpaceExtra (extra: LONGINT);
- PROCEDURE DrawChar (ch: CHAR);
- PROCEDURE DrawString (stringPtr:ADDRESS);
- PROCEDURE DrawText (textBuf: ADDRESS; firstByte,byteCount: INTEGER);
- PROCEDURE CharWidth (ch: CHAR): INTEGER;
- PROCEDURE StringWidth (stringPtr:ADDRESS): INTEGER;
- PROCEDURE TextWidth (textBuf: ADDRESS; firstByte,byteCount: INTEGER): INTEGER;
- PROCEDURE GetFontInfo (VAR info: FontInfo);
- (*Box drawing utility*)
- PROCEDURE TextBox( inText: ADDRESS; textLength: LONGINT; r: Rect; style: INTEGER );(*INLINE $A9CE;*)
-
-
- (* Graphical Operations on Rectangles *)
- PROCEDURE FrameRect (VAR r: Rect);
- PROCEDURE PaintRect (VAR r: Rect);
- PROCEDURE EraseRect (VAR r: Rect);
- PROCEDURE InvertRect (VAR r: Rect);
- PROCEDURE FillRect (VAR r: Rect;VAR pat: Pattern);
-
- (* MacIntosh QuickDraw Region Operations *)
- PROCEDURE NewRgn(): RgnHandle;
- PROCEDURE DisposeRgn(rgn: RgnHandle);
- PROCEDURE CopyRgn (srcRgn,dstRgn: RgnHandle);
- PROCEDURE SetEmptyRgn(rgn: RgnHandle);
- PROCEDURE SetRectRgn(rgn: RgnHandle; left,top,right,bottom: INTEGER);
-
- (* Graphical Operations on Regions *)
- PROCEDURE FrameRgn (rgn: RgnHandle);
- PROCEDURE PaintRgn (rgn: RgnHandle);
- PROCEDURE EraseRgn (rgn: RgnHandle);
- PROCEDURE InvertRgn (rgn: RgnHandle);
- PROCEDURE FillRgn (rgn: RgnHandle; pat: Pattern);
-
- (* Graphical Operations on BitMaps *)
- PROCEDURE ScrollRect(VAR dstRect: Rect; dh,dv: INTEGER; updateRgn: RgnHandle);
- PROCEDURE CopyBits (VAR srcBits,dstBits: BitMap;
- VAR srcRect,dstRect: Rect;
- mode: INTEGER;
- maskRgn: RgnHandle);
-
- END QuickDraw.
- (*======================================================================*)
-
-
-
-