In consonance with the concepts that I explained at the introduction of this article, the GD library comes well-equipped with a neat number of drawing functions. These functions are useful when utilized within a specific PHP application that requires the display of different types of basic shapes to users. The GD extension can also help you create complex images, like 2D and 3D graphics, flow charts, and pie drawings, by using the appropriate set of functions provided by the library in question. Please take a look at the following code sample, which demonstrates how to use the "imagearc()" function to display obviously different arcs. Here are the corresponding examples, so take some time and study them: // example of 'imagearc()' function - draws a white arc try{ As you can see, the above "imagearc()" GD function is tasked with displaying several types of arcs on a given image stream. It takes up a few intuitive input parameters, such the image stream resource to draw on, the respective start and end coordinates, and finally the arc inclination and its corresponding color. The previous script will display on the browser a white-colored arc, similar to the one shown below:
Due to the great versatility exposed by this function, it's possible to create several types of arcs, with different colors. The following examples illustrate this concept very clearly, so have a look at them, please: // example of 'imagearc()' function - draws a red arc try{
// example of 'imagearc()' function - draws a green arc try{
Okay, at this point I believe that you now understand how to use the GB extension to draw a few basics arcs on a given image stream, thus it's time to move forward and continue exploring more functions that come integrated with this library. And speaking of analyzing some additional functions bundled with the GD library, in the section to come I'll show you how to use two more functions to display some basic characters on a specified image stream. To see how this will be achieved, jump ahead and read the next few lines. I'll be there, waiting for you.
blog comments powered by Disqus |
|
|
|
|
|
|
|