1 image.test ImageToolkitGdTestCase::getPixelColor($image, $x, $y)

Function for finding a pixel's RGBa values.

File

core/modules/simpletest/tests/image.test, line 239
Tests for core image handling 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));
}