Sep
17
2010
imagecolorallocatealpha()

imagecolorallocatealpha

(PHP 4 >= 4.3.2, PHP 5)

imagecolorallocatealpha -- Allocate a color for an image

Описание

int imagecolorallocatealpha ( resource image, int red, int green, int green, int alpha )

imagecolorallocatealpha() behaves identically to imagecolorallocate() with the addition of the transparency parameter alpha which may have a value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.

Returns FALSE if the allocation failed.


<?php
$size 
300;
$image=imagecreatetruecolor($size$size);

// something to get a white background with black border
$back imagecolorallocate($image255255255);
$border imagecolorallocate($image000);
imagefilledrectangle($image00$size 1$size 1$back);
imagerectangle($image00$size 1$size 1$border);

$yellow_x 100;
$yellow_y 75;
$red_x    120;
$red_y    165
$green_x   187;
$green_y   125
$radius   150;

// allocate colors with alpha values
$yellow imagecolorallocatealpha($image255255075);
$red    imagecolorallocatealpha($image2550075);
$green   imagecolorallocatealpha($image0025575);

// drawing 3 overlapped circle
imagefilledellipse($image$yellow_x$yellow_y$radius$radius$yellow);
imagefilledellipse($image$red_x$red_y$radius$radius$red);   
imagefilledellipse($image$green_x$green_y$radius$radius$green);

// don't forget to output a correct header!
header('Content-type: image/png');

// and finally, output the result
imagepng($image);
imagedestroy($image);
?>

Замечание: Эта функция нуждается в GD версии 2.0.1 или выше.

See also imagecolorallocate() and imagecolordeallocate().

 
 
 
Комментарии
Добавить новый Поиск
Оставить комментарий
Имя:
Email:
 
Веб-сайт:
Тема:
UBB-Код:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Пожалуйста, введите проверочный код, который Вы видите на картинке.
Powered by !JoomlaComment 3.26

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 

Кто онлайн

Сейчас 22 гостей онлайн