LINE - DualBrain/bsharp Wiki
To draw lines and boxes on the screen.
LINE [(x1,y1)]-(x2,y2) [,[attribute][,B[F]][,style]]
x1,y1 and x2,y2 specify the end points of a line.
Resolution mode is determined by the SCREEN statement.
B (box) draws a box with the points (x1,y1) and (x2,y2) at opposite corners.
BF (filled box) draws a box (as
,B) and fills in the interior with points.
If attribute is not specified, two commas must be used before
LINE supports the additional argument style. style is a 16-bit integer mask used when putting down pixels on the screen. This is called line-styling.
LINE stores a point on the screen, it uses the current circulating bit in style. If that bit is 0, no store will be done. If the bit is a 1, then a normal store is done. After each point, the next bit position in style is selected.
Since a 0 bit in style does not clear out the old contents, you may wish to draw a background line before a styled line, in order to force a known background.
style is used for normal lines and boxes, but is illegal for filled boxes.
BF parameter is used with the style parameter, a "Syntax" error will occur.
When out-of-range values are given in the
LINE statement, the coordinates that are out of range are not visible on the screen. This is called line-clipping.
In the syntax shown here, the coordinate form
STEP (x offset, y offset) is not shown. However, this form can be used wherever a coordinate is used.
LINE statement, if the relative form is used on the second coordinate, it is relative to the first coordinate.
LINE statement, the last referenced point is x2, y2.
The simplest form of
LINE is the following:
This draws a line from the last point referenced to the point (x2,y2) in the foreground color.
Draws a horizontal line which divides the screen in half from top to bottom in SCREEN
10 CLS 20 LINE -(RND*319,RND*199),RND*4 30 GOTO 20
Draw lines forever using random attributes.
10 FOR X=0 TO 319 20 LINE (X,0)-(X,199),X AND 1 30 NEXT
Draws an alternating pattern: line on, line off.
10 CLS 20 LINE -(RND*639,RND*199),RND*2,BF 30 GOTO 20
Draws lines all over the screen.
Draws a square box in the upper left corner of the screen.
Draws the same box and fills it in.
Draws the same filled box in magenta in SCREEN
Draws the same box if SCREEN
2 is specified.
400 SCREEN 1 410 LINE(160,100)-(160,199),,,&HCCCC
Draws a vertical dotted line down the center of the screen in SCREEN
220 SCREEN 2 230 LINE(300,100)-(400,50),,B,&HAAAA
Draws a rectangle with a dotted line in SCREEN
Draws a dotted line from the upper left corner to the screen center.