PHP CREATE PNG ALPHA

class generatePNG {
var $red = 0;
var $grn = 0;
var $blu = 0;

function draw($name, $red=0, $grn=0, $blu=0) {
$width = 16;
$height = 16;
$this->red = $red;
$this->grn = $grn;
$this->blu = $blu;
$image = imagecreatetruecolor ( $width, $height );
$back = imagecolorallocate($image, 255, 255, 255);
imagefilledrectangle($image, 0, 0, $width, $height, $back);
$foreground = imagecolorallocatealpha($image, $this->red, $this->grn, $this->blu, 75);
imagefilledrectangle($image,0,0,$width, $height,$foreground);
imagepng ( $image, PATH_PLUGINS . "edRegister/public_html/schoolMap/images/" . $name . ".png" );
}
}

$text = new generatePNG ();
$text->draw ('test1',255,0,0);

posted @ 2012-11-02 11:05 Jake.Xu 阅读(...) 评论(...) 编辑 收藏