Lines, Rectangles, and Fills

A diagram illustrating lines, rectangles, and fills of the lcd. object.

Lines

The lcd.line method draws a line between any points. The lcd.verline and lcd.horline methods draw vertical and horizontal lines, respectively. Use the latter two methods whenever possible, because they work faster than the generic lcd.line. The line is drawn using the color set in the lcd.forecolor property (see Working With Pixels/Lines), and the line width is defined by the lcd.linewidth property. In the following example, we draw a picture as shown above, on the left:

Tibbo BASIC
lcd.forecolor=color_blue 'we assume we have already set color_blue
lcd.verline(0,0,20) 'vertical line, width=1 (default)
lcd.horline(0,20,0) 'horizontal line, width=1 (default)
lcd.linewidth=3 'change the width
lcd.line(2,2,20,20) 'line at 45 degrees, width=3

Defining lcd.linewidth > 1 (3 for one of the lines in the above example) creates "fatter" lines. Notice how two points of the line are drawn and the location of each specified coordinate.


Rectangles

The lcd.rectangle method draws an unfilled rectangle using lcd.forecolor as the "pen" color and the pen width defined by the lcd.linewidth property. The lcd.filledrectangle method will additionally paint the internal area using lcd.backcolor. Here is an example and its result:

Tibbo BASIC
lcd.forecolor=color_blue 'we assume we have already set color_blue
lcd.backcolor=color_green 'we assume we have already set color_green
lcd.rectangle(0,0,20,20) 'width=1 (default)
lcd.linewidth=3
lcd.filledrectangle(5,5,15,15) 'width=3, filled with background color 

Fills

The lcd.fill method paints a specified area with lcd.forecolor:

Tibbo BASIC
lcd.forecolor=color_blue 'we assume we have already set color_blue
lcd.fill(0,0,16,16)
lcd.forecolor=color_green 'we assume we have already set color_green
lcd.fill(5,5,16,16) 

Lines, Rectangles, and Fills

Lines

Rectangles

Fills