/** * Create a new adapter instance from a new empty image * * @param int $width * @param int $height * @param \Phower\Image\ColorInterface $background * @return \Phower\Image\Adapter\GdAdapter * @throws InvalidArgumentException */ public static function create($width, $height, ColorInterface $background = null) { if ((int) $width < 1) { throw new InvalidArgumentException('Width must be greater than 0.'); } if ((int) $height < 1) { throw new InvalidArgumentException('Height must be greater than 0.'); } if ($background === null) { $background = new Color(); } $resource = imagecreatetruecolor($width, $height); imagealphablending($resource, true); imagefill($resource, 0, 0, $background->toInt()); return new static($resource); }
public function testToIntMethodReturnsColorAsAnIntegerValue() { $color = new Color(255, 204, 0, 0.5); $this->assertEquals(1090505728, $color->toInt()); }