1 image.test ImageToolkitGdTestCase::colorsAreEqual($color_a, $color_b)

Function to compare two colors by RGBa.

File

core/modules/simpletest/tests/image.test, line 221
Tests for core image handling API.

Class

ImageToolkitGdTestCase
Test the core GD image manipulation functions.

Code

function colorsAreEqual($color_a, $color_b) {
  // Fully transparent pixels are equal, regardless of RGB.
  if ($color_a[3] == 127 && $color_b[3] == 127) {
    return TRUE;
  }

  foreach ($color_a as $key => $value) {
    if ($color_b[$key] != $value) {
      return FALSE;
    }
  }

  return TRUE;
}