protected static function GDToolkitReflect::alphaGetMin in ImageCache Reflect 8
Compute the minimum alpha value of the pixels of a given image resource.
Warning, this function is very expensive.
Parameters
resource $src_im: Source image link resource.
Return value
int Minimum alpha value in the image resource.
1 call to GDToolkitReflect::alphaGetMin()
- GDToolkitReflect::reflect in lib/
Drupal/ imagecache_reflect/ Plugin/ ImageToolkit/ GDToolkitReflect.php - Creates an image with a reflection-like effect from a provided image.
File
- lib/
Drupal/ imagecache_reflect/ Plugin/ ImageToolkit/ GDToolkitReflect.php, line 227 - Contains \Drupal\imagecache_reflect\Plugin\ImageToolkit\GDToolkitReflect.
Class
- GDToolkitReflect
- Creates a reflect operation for the GD library.
Namespace
Drupal\imagecache_reflect\Plugin\ImageToolkitCode
protected static function alphaGetMin($src_im) {
$w = imagesx($src_im);
$h = imagesy($src_im);
// Turn alpha blending off.
imagealphablending($src_im, FALSE);
// Find the most opaque pixel in the image (smallest alpha value).
$minalpha = 127;
for ($x = 0; $x < $w; $x++) {
for ($y = 0; $y < $h; $y++) {
$alpha = imagecolorat($src_im, $x, $y) >> 24 & 0xff;
if ($alpha < $minalpha) {
$minalpha = $alpha;
}
}
}
return $minalpha;
}