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

视频捕捉/采集

开发平台:

Visual C++

  1. #!/usr/local/bin/perl
  2. use GD;
  3. # test scaling, translation, transformation
  4. $im = new GD::Image(380,225);
  5. $black = $im->colorAllocate(0, 0, 0);
  6. $white = $im->colorAllocate(255, 255, 255);        
  7. $red = $im->colorAllocate(255, 0, 0);      
  8. $blue = $im->colorAllocate(0,0,255);
  9. $yellow = $im->colorAllocate(255,250,205);
  10. # Create a triangle
  11. $poly = new GD::Polygon;
  12. $poly->toPt(50,50);
  13. $poly->toPt(100,0);
  14. $poly->toPt(-50,50);
  15. $poly->toPt(-50,-50);
  16. $im->filledPolygon($poly,$yellow);
  17. # Stretch it a bit
  18. $poly->scale(1.8,1.0);
  19. $poly->offset(100,0);
  20. $im->filledPolygon($poly,$red);
  21. # Rotate it
  22. $poly->transform(0.55,0.20,0.0,1,-25,50);
  23. $im->filledPolygon($poly,$blue);
  24. print $im->gif;