Drawing Thick Lines


Want to control the thickness of the lines you draw? Use the imagesetthickness function:

 imagesetthickness(resource image, int thickness) 

When you call this function and pass an image to it, it sets the drawing width for that image, in pixels. For example, here's how you might add a call to that function in phpthickline.php, where we want to draw lines that are four pixels thick:

 <?php     $image_height = 100;     $image_width = 300;     $image = imagecreate($image_width, $image_height);     imagesetthickness($image, 4);     imageline($image, 20, 20, 70, 80, $draw_color);         .         .         . 

You can see this at work in phpthickline.php and phpthickline.html, Figure 4, where we're drawing the lines from the previous chunk, now four pixels wide.

Figure 4. Drawing thick lines.




    Spring Into PHP 5
    Spring Into PHP 5
    ISBN: 0131498622
    EAN: 2147483647
    Year: 2006
    Pages: 254

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net