PHP:Flags with Polygons Tutorial

From Progzoo
Jump to navigation Jump to search

A polygon is a closed shape made up of straight lines (like a triangle or a square). See PHP:Polygons for details of how to do this.


The Napier flag is a red triangle on a white square. It suggests the letter N.
We create a polygon in order to fill it. The ImagePolygon is part of the standard PHP4 package. We create a polygon points array, then call the ImagePolygon method.

[Font] [Default] [Show] [Resize] [History] [Profile]


To complete the flag of the Bahamas you must add the black triangle which represents the unity and vigour of the people.


[Font] [Default] [Show] [Resize] [History] [Profile]


We need to draw four triangles in order to draw the flag of Jamaica. If we get it right we will leave a yellow cross.


[Font] [Default] [Show] [Resize] [History] [Profile]


The Seychelles has a cheerful flag; four triangles and a quadrilateral.


We tire of coming up with names for our polygons. In this example we reuse the same old polygon.

[Font] [Default] [Show] [Resize] [History] [Profile]