function ToolkitGdTest::getPixelColor
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php \Drupal\KernelTests\Core\Image\ToolkitGdTest::getPixelColor()
- 10 core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php \Drupal\KernelTests\Core\Image\ToolkitGdTest::getPixelColor()
- 11.x core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php \Drupal\KernelTests\Core\Image\ToolkitGdTest::getPixelColor()
Function for finding a pixel's RGBa values.
1 call to ToolkitGdTest::getPixelColor()
- ToolkitGdTest::testManipulations in core/
tests/ Drupal/ KernelTests/ Core/ Image/ ToolkitGdTest.php - Tests height, width and color for the corners for the final images.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Image/ ToolkitGdTest.php, line 91
Class
- ToolkitGdTest
- Tests for the GD image toolkit.
Namespace
Drupal\KernelTests\Core\ImageCode
public function getPixelColor(ImageInterface $image, int $x, int $y) : array {
$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));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.