An introduction to computer programming using Ruby. Comprising
- Tutorials which present problems and their solutions.
- How to... guides to completing common tasks.
- Assessments graded problems with solutions.
An Example: drawing the French tricolour
You can create images using the GD2 library. The first tutorial Flags looks at drawing flags of the world, from simple flags such as Libya to more complicated flags such as the Stars and Stripes of the USA.
With GD2 you can set the canvas color and draw a rectangle to create simple images.
Notice that the blue rectangle has corners at (0,0) and (50,100) and has color [1,0,0] <div style="clear:left"/>
g.color = image.palette.resolve Color[1.0, 0, 0] g.rectangle(0,0,50,100,filled=true)
Consult the User's Guide for information on changing material in progzoo.
You can mess about in the Playpen.