/** * @param int $width = 0 * @param int $height = 0 * @param GDColor $bg = new GDColor(255,255,255,0) * * @return resource */ public static function Canvas($width = 0, $height = 0, GDColor $bg = null) { if (!$bg) { $bg = new GDColor(255, 255, 255, 0); } $canvas = imagecreatetruecolor((int) $width, (int) $height); imagealphablending($canvas, false); imagesavealpha($canvas, true); $bg->Allocate($canvas); imagefill($canvas, 0, 0, $bg->Resource()); return $canvas; }