PHP/Graphics Image/imagecolortransparent

Материал из Web эксперт
Перейти к: навигация, поиск

Adding Transparency

 
<?
    $image = imagecreatetruecolor(400,400);
    $black = imagecolorallocate($image, 0, 0, 0);
    imagecolortransparent($image, $black);
?>



Using Brushes

 
<?
    $brush = imagecreate(100,100);
    $brushtrans = imagecolorallocate($brush, 0, 0, 0);
    imagecolortransparent($brush, $brushtrans);
    for ($k = 1; $k < 18; ++$k) {
            $color = imagecolorallocate($brush, 255, $k * 15, 0);
            imagefilledellipse($brush, $k * 5, $k * 5, 5, 5, $color);
    }
    imagepng($brush);
    imagedestroy($brush);
?>