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); }
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); }