2010-03-11 20 views

回答

0

透明圖像的問題在於,邊框上的半透明像素會用您指定爲透明顏色的顏色部分着色,如果您可以接受這種顏色,那麼您可以使用您指定的抗鋸齒弧線庫,只是把他們的例子(我使用的優化版本)的開頭以下內容:

include ("./imageSmoothArc_optimized.php"); 

$img = imageCreateTrueColor(648, 800); 
imagealphablending($img,true); 
$color = imageColorAllocate($img, 255, 255, 255); 
$transparent_color = imageColorAllocate($img, 0, 0, 0); 
imagefill($img, 5, 5, $transparent_color); 
imagecolortransparent($img, $transparent_color); 

這會給你一個透明的PNG圖像。由於我將黑色指定爲透明顏色,因此圓形將在邊緣附近變爲黑色,並且您只能在深色背景上使用它。