Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Drawing a Triangler in php

Sun Oct 26, 2008 11:05 pm

Code:
<?php
     header
("Content-type: image/png");
   
     
$im = ImageCreate (175, 175);
   
     
$grey = ImageColorAllocate ($im, 230, 230, 230);
     
$black = ImageColorAllocate ($im, 0, 0, 0);
   
     
$coordinates = array();
   
     
$coordinates[0] = 0;            // Point 1 x
     
$coordinates[1] = 150;          // Point 1 y
     
$coordinates[2] = 150;          // Point 2 x
     
$coordinates[3] = 150;          // Point 2 y
     
$coordinates[4] = 75;           // Point 3 x
     
$coordinates[5] = 75;           // Point 3 y
   
     
ImageFilledPolygon($im, $coordinates, 3, $black);
   
     
ImageString($im, 3, 5, 5, "Figure 18.4: Triangle", $black);
     
ImagePng ($im);
     
ImageDestroy ($im);
?>




Post a reply
  Related Posts  to : Drawing a Triangler in php
 Drawing a Square in php     -  
 Drawing Lines in php     -  
 Drawing a Polygon in php     -  
 php drawing a circle     -  
 drawing sonic     -  
 Drawing Octahedron using openGL     -  
 Drawing a triangle with colors     -  
 Drawing Torus using OpenGL     -  
 drawing a rotating sphere     -  
 DDA Line Drawing Algorithm     -  

Topic Tags

PHP Graphics