resvg

package module
v0.1.1-0...-51ad5a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2019 License: MPL-2.0 Imports: 6 Imported by: 0

README

go-resvg

convert SVG to PNG or image using resvg library

install

go get github.com/foolin/go-resvg

依赖: https://github.com/ungerik/go-cairo https://www.cairographics.org/

安装Cairo: For Debian and Debian derivatives including Ubuntu:

sudo apt-get install libcairo2-dev

For Fedora:

sudo yum install cairo-devel

For openSUSE:

zypper install cairo-devel

Mac OS X Using MacPorts, the port is called 'cairo', so you can just type:

   sudo port install cairo

And to upgrade to newer versions once installed:

   sudo port upgrade cairo

If you use fink instead, the command to install cairo is:

   sudo apt-get install cairo

Windows: Precompiled binaries for Windows platforms can be obtained in a variety of ways.

From Dominic Lachowicz:

Since GTK+ 2.8 and newer depends on Cairo, you can have Cairo installed on Win32 as a side-effect of installing GTK+. For example, see The Glade/GTK+ for Windows Toolkit.

From Daniel Keep (edited by Kalle Vahlman):

Go to official GTK+ for Windows page.

https://www.gtk.org/download/

In order to use vcpkg packages, you first need to clone the vcpkg repository,

git clone https://github.com/Microsoft/vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat

You can then install the GTK packages with

vcpkg install gtk:x64-windows

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderImageFromString

func RenderImageFromString(svg string, option *Options) (img image.Image, err error)

func RenderImageWithIDFromFile

func RenderImageWithIDFromFile(svg, id string, option *Options) (img image.Image, err error)

func RenderPNGFromFile

func RenderPNGFromFile(svgpath, pngpath string, option *Options) error

func RenderPNGFromString

func RenderPNGFromString(svg, pngpath string, option *Options) error

Types

type Options

type Options struct {
	Width           int
	Height          int
	DPI             float64
	BackgroundColor string
}

func (*Options) ResvgBackgroundColor

func (o *Options) ResvgBackgroundColor() C.struct_resvg_color

func (*Options) ResvgOption

func (o *Options) ResvgOption() *C.struct_resvg_options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL