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
We produce three rectangles. One uses drawRect,
the others use fillRect.
test text
1. [ C++ ] Drawing rectangles and using colour
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.
test text
1. [ C# ] Drawing rectangles and using colour
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
The Graphics method allows us to draw or to fill rectangles.
DrawRectangle(Pens.Blue,10,10,70,50)
Draws the rectangle using the blue pen.
FillRectangle(Brushes.Red,200,0,100,400)
Fills the rectangle. The top left corner of the rectangle is
at 200,0 the width and height are 100 and 400.
This fill a rectangle with an awful pink. The three numbers are the
Red, Green and Blue components. The maximum value for each component
is 255 - so 255,128,128 means full red, half green and half
blue.
We produce three rectangles. One uses drawRect,
the others use fillRect.
test text
1. [ Java ] Drawing rectangles and using colour
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
The Graphics class permits us to draw on a surface.
Useful methods of this class:
This method doesn't do anything immediately, but the draw and
fill operation will be in red from now on. There are a handful of colours
we can use: black, blue, cyan,
darkGray, gray, green,
lightGray, magenta, orange,
pink, red, white,
yellow.
setColor(new Color(255,128,128))
This sets the color to an awful pink. The three numbers are the
Red, Green and Blue components. The maximum value for each component
is 255 - so 255,128,128 means full red, half green and half
blue.
We produce three rectangles. One uses drawRect,
the others use fillRect.
test text
1. [ Perl ] Drawing rectangles and using colour
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
We produce three rectangles. One uses drawRect,
the others use fillRect.
The first colour allocated is the background colour.
Rectangles are specified by the top-left and bottom-right corners.