protected function ToolkitImagemagickTest::getPixelColor in ImageMagick 8.2
Same name and namespace in other branches
- 8.3 tests/src/Functional/ToolkitImagemagickTest.php \Drupal\Tests\imagemagick\Functional\ToolkitImagemagickTest::getPixelColor()
- 8 tests/src/Functional/ToolkitImagemagickTest.php \Drupal\Tests\imagemagick\Functional\ToolkitImagemagickTest::getPixelColor()
Function for finding a pixel's RGBa values.
1 call to ToolkitImagemagickTest::getPixelColor()
- ToolkitImagemagickTest::testManipulations in tests/
src/ Functional/ ToolkitImagemagickTest.php - Test image toolkit operations.
File
- tests/
src/ Functional/ ToolkitImagemagickTest.php, line 880
Class
- ToolkitImagemagickTest
- Tests that core image manipulations work properly through Imagemagick.
Namespace
Drupal\Tests\imagemagick\FunctionalCode
protected function getPixelColor(ImageInterface $image, $x, $y) {
$toolkit = $image
->getToolkit();
$color_index = imagecolorat($toolkit
->getResource(), $x, $y);
$transparent_index = imagecolortransparent($toolkit
->getResource());
if ($color_index == $transparent_index) {
return [
0,
0,
0,
127,
];
}
return array_values(imagecolorsforindex($toolkit
->getResource(), $color_index));
}