Ejemplo n.º 1
0
 /**
  * Asaserting that two colors are equals
  * (JPG compression is not preserving colors for instance, so we
  * need a non-strict way to compare it).
  */
 protected function assertColorEquals($c1, $c2, $delta = 8)
 {
     $c1 = ImageColor::parse($c1);
     $c2 = ImageColor::parse($c2);
     list($r1, $g1, $b1) = $this->toRGB($c1);
     list($r2, $g2, $b2) = $this->toRGB($c2);
     $this->assertLessThan($delta, abs($r1 - $r2));
     $this->assertLessThan($delta, abs($g1 - $g2));
     $this->assertLessThan($delta, abs($b1 - $b2));
 }