shapes.pl
上传用户:qdrechuli
上传日期:2022-08-01
资源大小:917k
文件大小:1k
源码类别:

视频捕捉/采集

开发平台:

Visual C++

  1. #!/usr/local/bin/perl
  2. use GD;
  3. $im = new GD::Image(300,300);
  4. ($white,$black,$red,$blue,$yellow) = 
  5.     (
  6.      $im->colorAllocate(255, 255, 255),
  7.      $im->colorAllocate(0, 0, 0),
  8.      $im->colorAllocate(255, 0, 0),
  9.      $im->colorAllocate(0,0,255),
  10.      $im->colorAllocate(255,250,205)
  11.      );
  12. $im->transparent($white); # white color is transparent
  13. $im->interlaced(1); # cool venetian blinds effect
  14. # Create a flat wide rectangle paintbrush
  15. $brush = new GD::Image(10,10);
  16. $brush->colorAllocate(255,255,255); # white
  17. $brush->colorAllocate(0,0,0); # black
  18. $brush->transparent($white); # white is transparent
  19. $brush->filledRectangle(0,0,5,2,$black); # a black rectangle
  20. # Draw a friendly title (ha!)
  21. $im->string(gdLargeFont,150,10,"Hello world!",$red);
  22. $im->string(gdSmallFont,150,28,"Goodbye cruel world!",$blue);
  23. $im->stringUp(gdTinyFont,280,250,"I'm climbing the wall!",$black);
  24. $im->charUp(gdMediumBoldFont,280,280,"Q",$black);
  25. # Draw an oval
  26. $im->setBrush($brush);
  27. $im->arc(100,100,100,150,0,360,gdBrushed);
  28. $poly = new GD::Polygon;
  29. $poly->addPt(30,30);
  30. $poly->addPt(100,10);
  31. $poly->addPt(190,290);
  32. $poly->addPt(30,290);
  33. $im->polygon($poly,gdBrushed);
  34. $im->fill(132,62,$blue);
  35. $im->fill(100,70,$red);
  36. $im->fill(40,40,$yellow);
  37. # print the image to stdout
  38. print $im->gif;