Skip Menu |
 

This queue is for tickets about the GD CPAN distribution.

Report information
The Basics
Id: 38901
Status: resolved
Priority: 0/
Queue: GD

People
Owner: Nobody in particular
Requestors: vitalif [...] mail.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.41
Fixed in: (no value)



Subject: Could not get alpha value for some color index
Download (untitled) / with headers
text/plain 160b
There is no way to get alpha value for specified index in the color palette. GD's native method for this goal is gdImageAlpha(img, color). A patch is included.
Subject: GD-2.41-alpha.patch
Download GD-2.41-alpha.patch
text/x-diff 1.1k
diff -urN GD-2.41/GD.pm GD-2.41-alpha/GD.pm --- GD-2.41/GD.pm 2008-08-07 23:14:26.000000000 +0400 +++ GD-2.41-alpha/GD.pm 2008-09-01 21:11:20.773355123 +0400 @@ -680,7 +680,8 @@ This returns the color table index underneath the specified point. It can be combined with rgb() -to obtain the rgb color underneath the pixel. +to obtain the rgb color underneath the pixel and alpha() to obtain +the alpha value of the pixel. Example: @@ -696,6 +697,14 @@ @RGB = $myImage->rgb($peachy); +=item B<$alpha = $image-E<gt>alpha($index)> + +This returns the alpha value of the specified color index. + +Example: + + $alpha = $myImage->alpha($peachy); + =item B<$image-E<gt>transparent($colorIndex)> This marks the color at the specified index as being transparent. diff -urN GD-2.41/GD.xs GD-2.41-alpha/GD.xs --- GD-2.41/GD.xs 2006-08-22 03:48:18.000000000 +0400 +++ GD-2.41-alpha/GD.xs 2008-09-01 20:49:22.271022533 +0400 @@ -1191,6 +1191,18 @@ } int +gdalpha(image,color) + GD::Image image + int color + PROTOTYPE: $$ + CODE: + { + RETVAL=gdImageAlpha(image,color); + } + OUTPUT: + RETVAL + +int gdboundsSafe(image,x,y) GD::Image image int x
Thanks, this was added with 2.57, but toddr took credit for it.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.