Skip to content

Commit

Permalink
Some minor code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Feb 4, 2024
1 parent a87d59a commit c564479
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions resvg.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,7 @@ import (
"unsafe"
)

// Render renders svg data as a RGBA image.
func Render(data []byte, opts ...Option) (*image.RGBA, error) {
return New(opts...).Render(data)
}

// Version returns the resvg version.
func Version() string {
v := C.version()
ver := C.GoString(v)
C.free(unsafe.Pointer(v))
return ver
}

// Resvg wraps the [resvg c-api].
// Resvg wraps the [resvg c-api] to render svgs as standard a [image.RGBA].
//
// [resvg c-api]: https://github.com/RazrFalcon/resvg
type Resvg struct {
Expand Down Expand Up @@ -430,6 +417,19 @@ func init() {
image.RegisterFormat("svg", "<svg", Decode, DecodeConfig)
}

// Render renders svg data as a RGBA image.
func Render(data []byte, opts ...Option) (*image.RGBA, error) {
return New(opts...).Render(data)
}

// Version returns the resvg version.
func Version() string {
v := C.version()
ver := C.GoString(v)
C.free(unsafe.Pointer(v))
return ver
}

// Decode decodes a svg from the reader.
func Decode(r io.Reader) (image.Image, error) {
buf, err := io.ReadAll(r)
Expand Down

0 comments on commit c564479

Please sign in to comment.