function ImageToolkitGdTestCase::getPixelColor in SimpleTest 7
Function for finding a pixel's RGBa values.
1 call to ImageToolkitGdTestCase::getPixelColor()
- ImageToolkitGdTestCase::testManipulations in tests/
image.test - Since PHP can't visually check that our images have been manipulated properly, build a list of expected color values for each of the corners and the expected height and widths for the final images.
File
- tests/
image.test, line 239 - Unit tests for the Drupal Form API.
Class
- ImageToolkitGdTestCase
- Test the core GD image manipulation functions.
Code
function getPixelColor($image, $x, $y) {
$color_index = imagecolorat($image->resource, $x, $y);
$transparent_index = imagecolortransparent($image->resource);
if ($color_index == $transparent_index) {
return array(
0,
0,
0,
127,
);
}
return array_values(imagecolorsforindex($image->resource, $color_index));
}