imageantialias — Whether to use antialiasing (antialias) function.
bool imageantialias ( resource $image , bool $enabled )
Enables fast drawing anti-aliasing methods for lines and polygons. The alpha part is not supported. Use direct color mixing operations. For true color images only.
Line weight and style are not supported.
Using antialiasing and transparent background colors may have unexpected results. The color blending method treats the background color as if it were any other color. Lack of support for the alpha component disallows alpha-based antialiasing methods.
image : The image resource returned by the image creation function (such as imagecreatetruecolor()).
enabled : Whether to enable anti-aliasing.
Returns TRUE on success, or FALSE on failure.
<?php// Use an anti-aliased image and a normal image $aa = imagecreatetruecolor(400, 100);$normal = imagecreatetruecolor(200, 100);// Use the anti-aliasing function imageantialias($aa, true);// Settings Color$red = imagecolorallocate($normal, 255, 0, 0);$red_aa = imagecolorallocate($aa, 255, 0, 0);//Draw two lines imageline($normal, 0, 0, 200, 100, $red);imageline($aa, 0, 0, 200, 100, $red_aa);//Merge imageimagecopymerge($aa, $normal, 200, 0, 0, 0, 200, 100, 100);//Output image header('Content-type: image/png');imagepng($aa);imagedestroy($aa);imagedestroy($normal);?>
The picture of the output result of the above example is as follows: