コード例 #1
0
ファイル: ImageTests.php プロジェクト: leoogit/Image
 /**
  * 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));
 }
コード例 #2
0
ファイル: GD.php プロジェクト: clee03/metal
 /**
  * @inheritdoc
  */
 public function polygon(array $points, $color, $filled = false)
 {
     if ($filled) {
         imagefilledpolygon($this->resource, $points, count($points) / 2, ImageColor::gdAllocate($this->resource, $color));
     } else {
         imagepolygon($this->resource, $points, count($points) / 2, ImageColor::gdAllocate($this->resource, $color));
     }
     return $this;
 }