function ImageToolkitGdTestCase::getPixelColor

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

Function for finding a pixel's RGBa values.

1 call to ImageToolkitGdTestCase::getPixelColor()
ImageToolkitGdTestCase::testManipulations in drupal-7.x/modules/simpletest/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

drupal-7.x/modules/simpletest/tests/image.test, line 246
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));
}