PHP 教程
imagealphablending — 設(shè)定圖像的混色模式。
bool imagealphablending ( resource $image , bool $blendmode )
imagealphablending() 允許在真彩色圖像上使用兩種不同的繪畫(huà)模式。
在混色(blending)模式下,alpha 通道色彩成分提供給所有的繪畫(huà)函數(shù),例如 imagesetpixel() 決定底層的顏色應(yīng)在何種程度上被允許照射透過(guò)。作為結(jié)果,GD 自動(dòng)將該點(diǎn)現(xiàn)有的顏色和畫(huà)筆顏色混合,并將結(jié)果儲(chǔ)存在圖像中。結(jié)果的像素是不透明的。
在非混色模式下,畫(huà)筆顏色連同其 alpha 通道信息一起被拷貝,替換掉目標(biāo)像素?;焐J皆诋?huà)調(diào)色板圖像時(shí)不可用。
如果 blendmode 為 TRUE,則啟用混色模式,否則關(guān)閉。成功時(shí)返回 TRUE, 或者在失敗時(shí)返回 FALSE。
成功時(shí)返回 TRUE, 或者在失敗時(shí)返回 FALSE。
<?php // 創(chuàng)建圖像 $im = imagecreatetruecolor(100, 100); // 啟用混色模式 imagealphablending($im, true); // 畫(huà)一個(gè)正方形 imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0)); // 輸出 header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?>其他擴(kuò)展