English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
imagealphablending — Set the blending mode of the image.
bool imagealphablending ( resource $image , bool $blendmode )
imagealphablending() allows the use of two different painting modes on true color images.
In blending (blending) mode, the alpha channel color components are provided to all painting functions, such as imagesetpixel() determines the extent to which the underlying color should be allowed to shine through. As a result, GD automatically blends the existing color of the point and the brush color, and stores the result in the image. The resulting pixel is opaque.
In non-blending mode, the brush color along with its alpha channel information is copied and replaces the target pixel. Blending mode is not available when painting palette images.
If blendmode is TRUE, blending mode is enabled, otherwise disabled. Returns TRUE on success, or FALSE on failure.
imageThe image resource returned by the image creation function (such as imagecreatetruecolor()).
blendmoderegardless of whether blending mode is enabled. True color images are default to True, otherwise FALSE.
Returns TRUE on success, or FALSE on failure.
<?php // Create image $im = imagecreatetruecolor(100, 100); // Enable blending mode imagealphablending($im, true); // Draw a square imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0)); // output header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?>