We will draw two types of rectangles. They are called a rectangle area and a rectangle line.
The rectangle area has its interior filled with the current area color. It would be drawn using this command:
drawRectangleArea(x, y, width, height);
The rectangle line has its perimeter drawn with the current line thickness and color using this command:
drawRectangleLine(x, y, width, height);
In both the rectangleArea and rectangleLine commands the 'x' and 'y' parameters refer to the x- and y-coordinates for the upper left corner of the rectangle.
The 'width' and 'height' parameters have their obvious meanings shown in the diagram.
drawRectangleArea(3, 5, 6, 2);
drawRectangleLine(3, 5, 6, 2);
Here's a picture that shows the results of drawing a yellow rectangle area and then a black rectangle line:
Remember that setupGraph sets the area color to yellow, the line color to black, and the line thickness to 2.
The following example shows how to draw both the rectangle area and line. Be sure to notice that the area is drawn first. If you draw the area second, it will at least partially cover up the rectangle line.
Next tutorial: The printer at startup