Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
C++ Programming

Drawing and filling rectangles. Using colour.

 

Graphics

Drawing and filling rectangles. Using colour.

1. [ C++ ] Drawing rectangles and using colour


Big

draw
The word draw is often used to indicate that only the outline shows
pen and stroke are associated with drawing
fill
Typically fill is used to indicate that the shape is filled in a solid way
brush and fill are associated with filling
When we use draw the stroke colour and fill colour are used. The stroke determines the outline, the fill determines the fill. Either of these may take the value "none".
draw(DrawableRectangle(90,10,160,60))
The rectangle drawn has top-left corner at (90,10) and bottom right corner at (160,60).
strokeColor("blue")
The stroke dictates the outline colour for the following commands.
No action is taken immediately.
fillColor("blue")
The fill dictates the inside colour for the following commands.
No action is taken immediately.
Possible values for color include "none" "red" "blue" ColorRGB(.1,.2,.3)
ColorRGB( 0.1 , 0.2 , 0.3 )
The Red, Green and Blue components are specified. The maximium value for each is 1.0

We produce three rectangles. One uses drawRect, the others use fillRect.

three rectangles