home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / testgd.pl < prev    next >
Encoding:
Perl Script  |  2004-07-13  |  992 b   |  47 lines

  1. #!D:\temp\korbes\Perl\bin\perl
  2. ##
  3. ##  printenv -- demo CGI program which just prints its environment
  4. ##
  5. $F = new CGI;
  6. print $F->header('image/png');
  7.  
  8. use GD;
  9.  
  10. $im = new GD::Image(100,100);
  11.  
  12. # allocate black -- this will be our background
  13. $black = $im->colorAllocate(0, 0, 0);
  14.  
  15. # allocate white
  16. $white = $im->colorAllocate(255, 255, 255);        
  17.  
  18. # allocate red
  19. $red = $im->colorAllocate(255, 0, 0);      
  20.  
  21. # allocate blue
  22. $blue = $im->colorAllocate(0,0,255);
  23.  
  24. # make the background transparent and interlaced
  25.   $im->transparent($white);
  26.   #$im->interlaced('true');
  27.  
  28. # Put a black frame around the picture
  29.   $im->rectangle(0,0,99,99,$white);
  30.  
  31. #Inscribe an ellipse in the image
  32. # $im->arc(50, 25, 98, 48, 0, 360, $white);
  33. $im->arc(50,50,95,75,0,360,$blue);
  34.  
  35. # Flood-fill the ellipse. Fill color is red, and will replace the
  36. # black interior of the ellipse
  37. $im->fill(50, 50, $red);
  38.  
  39. binmode STDOUT;
  40.  
  41. # print the image to stdout
  42. print $im->png;
  43.  
  44.  
  45.  
  46.  
  47.