From Newsgroup: comp.lang.forth
On 10/09/2026 8:46 pm, Hans Bezemer wrote:
Can be used with any LINE command, as long as it draws a line between two absolute coordinates. ( x1 y1 x2 y2 --):
That was a 'star' effort! Never had the patience for graphics myself to it's good
to see someone else do it.
1 fload xplgraph
6 value color
: line ( x1 y1 x2 y2 --) 2swap moveto color line ; \ simulate using XPL graphics
\ General routine for a polyline or a polygon. H. Bezemer
\
\ Can be used with any LINE command, as long as it draws a line between
\ two absolute coordinates. ( x1 y1 x2 y2 --):
\ : line cr rot >r -rot r> rot 0 .r ." ," . 0 .r ." ," . ; \ dummy line word
variable 'lineto \ stores address of (lineto)
:noname drop drop drop drop ; constant (cancel) ( x1 y1 x2 y2 --)
:noname 2dup 2>r line 2r> 'lineto @ ; constant (lineto) ( x1 y1 x2 y2 -- x2 y2 xt)
:noname 2dup (lineto) ; constant (moveto) ( x y -- x y x y xt)
: polygon[ ['] line (moveto) ; ( -- xt1 xt2)
: polyline[ (cancel) (moveto) ; ( -- xt1 xt2)
: +point rot execute ; ( x1 y1 xt x2 y2 -- x2 y2 xt)
: ]poly drop 2>r rot 2r> +point ; ( xt1 x1 y1 x2 y2 xt2 --)
(lineto) 'lineto !
$12 SetVid \ 640x480x16
polygon[ \ start a polygon
75 300 +point \ now issue all the points
161 329 +point
161 419 +point
215 347 +point
301 373 +point
250 300 +point
301 227 +point
215 253 +point
161 181 +point
161 271 +point
]poly \ close the polygon
key drop \ admire
$03 SetVid \ text mode
--- Synchronet 3.22a-Linux NewsLink 1.2