a2Line

This command will draw a line on the screen.

  Syntax
a2Line x1, y1, x2, y2, color
a2Line x1, y1, x2, y2, color1, color2
  Parameters
x1
Float
This value specifies X coordinate of the starting point of the line.
y1
Float
This value specifies the Y coordinate of the starting point of the line.
x2
Float
This value specifies the X coordinate of the ending point of the line.
y2
Float
This value specifies the Y coordinate of the ending point of the line.
color1
Integer
This value is a 32 bit integer specifying alpha, red, green, and blue color levels of the starting point of the line.
color2
Integer
This value is a 32 bit integer specifying alpha, red, green, and blue color levels of the ending point of the line.

  Returns

This command does not return a value.

  Description

The command requires the starting and ending coordinates of the line and at least one 32 bit color value. If only one color is specified, the line is drawn in that color. If both colors are specified, the color of the line is a gradient from starting point to ending point. The line is anti-aliased by default.

  Example Code
for a = 1 to 100
    x1 = rnd(screen width())
    y1 = rnd(screen height())
    x2 = rnd(screen width())
    y2 = rnd(screen height())
    color1 = rgb(rnd(255), rnd(255), rnd(255))
    color2 = rgb(rnd(255), rnd(255), rnd(255))
    a2Line x1, y1, x2, y2, color1, color2
next a

WAIT KEY
  See also

a2SetLineAA
Advanced 2D Index
Main Menu