Exemple #1
0
 public static function colorAt($img, $x, $y)
 {
     if (isset(static::$data['colorAt'])) {
         return call_user_func(static::$data['colorAt'], $img, $x, $y);
     }
     return parent::colorAt($img, $x, $y);
 }
Exemple #2
0
 public function testColorConvertedToRGBIsCorrectColorComplexColor()
 {
     $img = imagecreate(1, 1);
     $black = imagecolorallocate($img, 15, 30, 45);
     $color = Color::colorAt($img, 0, 0)->toRGB();
     $this->assertSame(15, $color->getRed());
     $this->assertSame(30, $color->getGreen());
     $this->assertSame(45, $color->getBlue());
     imagedestroy($img);
 }