GD Shape Parameters

The lines you draw to form the shapes can be any color you choose; of a thickness you choose; and a style you choose. Image thickness will refer to all following lines until you change it...default is 1. In place of a color you may use the default, Brushed....this applies to line functions and gives an etched appearance. Creating your own brushes and using the style-brushed function create special effects for your line. They will be covered later.

Fill can be done with regular color or with transparent color. There are other functions including filling with an import image(tile) or part of an image. This will be covered later in more advanced effects.

The basic geometric shapes are used here; with x and y positions in regard to the background specified. In closed shapes, the lines of the shapes can be of a different color than the fill by drawing the image in one color and filled in another; or they may be the same by the imagefilled function. Closed shapes are circle, ellipse, rectangle, polygon. The arc is an open shape and must have the ends connected by a line to be filled.

Straight Line
Your basic line has the beginning x and y position and the ending x and y position.

imageRectangle or imageFilledRectangle
The x and y of the top left corner and the x and y of the bottom right corner.

imageEllipse or imageFilledEllipse
The first pair or numbers are the x and y of the center. The next two designate the number of pixels in the x coordinate to draw, and number of pixels in the y coordinate to draw. Having these last two numbers the same will draw a circle.

The first pair of coordinates designate the midpoint of the arc.
The next pair specifies the x or width of the arc and the y or height / depth to go before returning to your y position which is set by the degrees you choose.
The last pair are the degrees for your arc.. 180   0 will give you a half circle curving up......0   180 curving down.
The drawing of the arc begins at 3o'clock and goes CLOCKWISE. 0 360 will give you a circular shape if the width and height of the arc are equal. Some arc samples are here

imagePolygon or imageFilledPolygon
A polygon is a multi sided figure and must have at least three sides....(triangle). This consists of an x y pair for each point of the figure. For a triangle, three sets of x y, and so forth, the last set will automatically connect to your first x y pair. Be sure outside the bracket you put the number of points.There can be an unlimited number of points, and can be lines only or filled.

GD BasicsHome