/** * @param resource $image * @param QuarkFile $file * * @return resource */ public function GDAction($image, QuarkFile $file) { if (!$this->_color) { return $image; } imagettftext($image, $this->_size, $this->_position->angle, $this->_position->x, $this->_position->y, $this->_color->Allocate($image), $this->_font, $this->_text); $this->_color->Deallocate($image); return $image; }
/** * @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; }