* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.LINE Statement Details.

  QuickSCREEN      Details      Example      Contents      Index
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
LINE Statement Details
Syntax
  LINE [[STEP] (x1,y1)]-[STEP] (x2,y2) [,[color][,[B[F]][,style]]]
 
The coordinates (x1,y1) and (x2,y2) specify the endpoints of the line;
note that the order in which these endpoints appear is unimportant,
since a line from (10,20) to (120,130) is the same as a line from
(120,130) to (10,20).
 
The STEP option makes the specified coordinates relative to the most recent
point, instead of absolute, mapped coordinates. For example, if the most
recent point referred to by the program is (10,10), then
 
  LINE -STEP (10,5)
 
draws a line from (10,10) to the point with x coordinate equal to
10 + 10 and y coordinate equal to 10 + 5, or (20,15).
 
You may establish a new most recent point by initializing the screen
with the CLS and SCREEN statements. Using the PSET, PRESET, CIRCLE,
and DRAW statements will also establish a new most recent point.
 
Variations of the STEP argument are shown below. For the following
examples, assume that the last point plotted was (10,10):
 
  Statement                      Description
 
  LINE -(50,50)                  Draws from (10,10) to (50,50)
 
  LINE -STEP(50,50)              Draws from (10,10) to (60,60); that
                                 is, to 10 plus offset 50
 
  LINE (25,25)-STEP(50,50)       Draws from (25,25) to (75,75); that
                                 is, to 25 plus offset 50
 
  LINE STEP(25,25)-STEP(50,50)   Draws from (35,35) to (85,85); that
                                 is, from 10 plus offset 25 to that
                                 point plus offset 50
 
  LINE STEP(25,25)-(50,50)       Draws from (35,35) to (50,50); that
                                 is, from 10 plus offset 25 to
                                 absolute 50
 
The color is the number of the color in which the line is drawn.
(If the B or BF options are used, the box is drawn in this color.)
See the COLOR statement details and the SCREEN statement details for
information about how to specify a color number in different screen
modes.
 
The B option draws a box with the points (x1,y1) and (x2,y2) specifying
diagonally opposite corners.
 
The BF option draws a filled box. This option is similar to the B option;
BF also paints the interior of the box with the selected color.
 
The style is a 16-bit integer mask used to put pixels on the screen. Using
the style argument is called "line styling." With line styling, LINE reads
the bits in style from left to right. If a bit is 0, then no point is
plotted; if the bit is 1, a point is plotted. After plotting a point, LINE
selects the next bit position in style.
 
Because a 0 bit in style does not change the point on the screen, you may
want to draw a background line before using styling so you can have a known
background. Style is used for normal lines and boxes, but has no effect on
filled boxes.
 
When coordinates specify a point that is not in the current viewport, the
line segment is clipped to the viewport.
* * ** * * * *