home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-17 | 1.6 KB | 76 lines | [TEXT/PRLG] |
- The draw/3 predicate in Open Prolog.
-
- The draw/3 predicate is a fairly buggy graphics interface to Open Prolog.
- Please don't use these facilities unless you're happy (!) to allow your system to
- crash occasionally.
- The window isn’t fully integrated into the window handling system, so some odd behaviour can occur.
- To save or print any drawings, it’s necessary to copy them via the clipboard to an appropriate application.
-
- draw/3 is an external built-in predicate that takes three arguments.
-
- The first argument is the command number.
-
- The second argument is the parameter.
-
- The third argument is a result, which is not used.
-
- The commands currently implemented and their arguments are described below.
-
- Where no argument is specified, use the anonymous variable as a placeholder.
-
-
- Command Explanation Arguments
-
- 1 open the graphics window: <name>(Top,Left,Bottom,Right)
-
- 2 close the graphics window _
-
- 3 draw a line: line(StartX,StartY,EndX,EndY)
-
- 4 draw a rectangle: rect(Left,Top,Right,Bottom)
-
- 5 draw text: text(X,Y,TextAtom)
-
- 6 set pen size: penSize(Width,Height)
-
- 7 set pen mode: penMode(ModeNumber)
-
- 8 set pattern: penPattern(PatternNumber)
-
- 9 set foreground colour color(ColorNumber)
-
- 10 set background colour color(ColorNumber)
-
- 11 erase window contents _
-
- 12 draw oval oval(Left,Top,Right,Bottom)
-
-
- colorNumbers
-
- 0 to 7
-
- black,yellow,magenta,red,cyan,green,blue,white
-
-
- patterns
-
- 1-38
-
- see Inside Macintosh, Vol 1, p474
-
-
- modeNumber
-
- 8-15
-
- see Inside Macintosh, Vol 1, p169/170
-
-
- examples
- draw(1,'Graphics Window'(40,40,200,200),_). %open a window
-
- draw(4,rect(20,20,180,200),_). %draw a rectangle
-
- draw(2,_,_). %close the graphics window
-