You are here

function ImageToolkitGdTestCase::getPixelColor in Drupal 7

Function for finding a pixel's RGBa values.

1 call to ImageToolkitGdTestCase::getPixelColor()
ImageToolkitGdTestCase::testManipulations in 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

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