PHP imagealphablending - to set the image blending mode
imagealphablending - to set the image blending mode.
grammar
bool imagealphablending ( resource $image , bool $blendmode )
imagealphablending () allows the use of two different modes of drawing on true color images.
Under mixing (blending) mode, alpha channel component of the color supplied to all drawing function, such as imagesetpixel () determine the underlying color should be allowed to the extent irradiated through. As a result, GD automatically point the existing color and brush color mixing, and stores the result in the image. The results of the pixel is opaque.
In non-blending mode, the pen color along with its alpha channel information is copied together, replace target pixels. Blending mode is not available at the time of painting palette image.
If blendmode TRUE, then blending mode is enabled, otherwise closed. Successful return TRUE, or on failure returns FALSE.
parameter
- image created by the image function (for example imagecreatetruecolor ()) returns an image resource.
- blendmode whether to enable blending mode.True color images default to True, otherwise FALSE.
return value
Successful return TRUE, or on failure returns FALSE.
Examples
<?php // 创建图像 $im = imagecreatetruecolor(100, 100); // 启用混色模式 imagealphablending($im, true); // 画一个正方形 imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0)); // 输出 header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?>