/** * Creates a transparent (PNG, JPG) image with a <code>aWidth</code> and <code>aHeight</code>. * * @param int $aWidth The width of the image * @param int $aHeight The height of the image * @return resource */ public static function createTransparentImage($width, $height) { $imgRes = self::createImage($width, $height); $color = ColorFactory::white(127); $transparent = self::allocateColor($imgRes, $color); imagefill($imgRes, 0, 0, $transparent); return $imgRes; }
/** * Creates a new ImageFilterRotate * * @param int $aAngle The degrees to rotate the image * @param String $aBgcolor The background color to apply * */ public function __construct($angle = 90, $aBgcolor = null) { $this->angle = Args::int($ange, 'angle')->required()->min(-360)->max(360)->value(function ($val) { return $val < 0 ? 360 - $val : $val; }); if ($aBgcolor === null) { $this->bgColor = ColorFactory::white(); } else { $this->bgColor = $aBgcolor instanceof Color ? $aBgcolor : new Color($aBgcolor); } }
/** * Creates a transparent (PNG, JPG) image with a <code>aWidth</code> and <code>aHeight</code>. * * @param int $aWidth The width of the image * @param int $aHeight The height of the image * @return resource */ public static function createTransparentImage($width, $height) { Args::int($width, 'width')->required()->min(0); Args::int($height, 'height')->required()->min(0); $color = ColorFactory::white(127); $imgRes = imagecreatetruecolor($width, $height); imageantialias($imgRes, true); imagealphablending($imgRes, true); imagesavealpha($imgRes, true); $transparent = self::allocateColor($imgRes, $color); imagefill($imgRes, 0, 0, $transparent); return $imgRes; }
public function testWhite() { $this->assertColor(ColorFactory::white(), "ffffff"); }