note 60439 deleted from function.imagecolorallocate by tularis
| From: | tularis@php.net | Date: | Sat, 07 Jan 2006 09:32:13 +0000 |
| Subject: | note 60439 deleted from function.imagecolorallocate by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101340@lists.php.net to get a copy of this message | ||
Note Submitter: checkusout at kissvote dot com
Reason: bad code
----
I hope this isn't redundant or already documented, but I wanted a way to take a color as
returned by imagecolorallocate(), and extract its RGB values (because maybe I wanted to pass colors
around with functions and do stuff with their values. All this function does is break a 3 byte
number.
$color=$imagecolorallocate($image,200,200,200);
die(print_r(ImageColorToRGB($color)));
function ImageColorToRGB($color)
{
$arr=array();
$arr[0]=$arr['r']=(($transparent>>16) & 0xFF);
$arr[1]=$arr['g']=(($transparent>>8) & 0xFF);
$arr[2]=$arr['b']=(($transparent) & 0xFF);
return $arr;
}