GD Library Shapes-1

First Shapes In this script you will see that we have now added a line that makes the background transparent. To see your creation on white simply comment out the transparent back line using two slashes//.

Remember all x y positions are based on a canvas of 300x300 or the size you designate...For this, center is 150x150.

imagesetthickness is introduced here as well. Default is one. To change the thickness for each shape just insert it before the drawing of the shape. This is done in the script.

Imagefill is also introduced. This is how you color an image after it is drawn. Note it in the script. It is an x y position inside the shape with a color.

First thing to do here is rearrange the shapes(Do not move them above where it says FUNCTIONS)....put the last two first and see what happens...

Why does it do that?

Can you make it look like it did when those two were on the bottom, but leave them on top...??

A circle is just an ellipse told to draw the x and y equal...There are several ways to get circles....we'll cover them all but any one will work at any time....we'll use ellipse for now....

Change the colors and the positions. Change the layers...See if you can make something with just these shapes.

GD BasicsHome