The cl-resvg Reference Manual

This is the cl-resvg Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:19:44 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-resvg

An up-to-date bindings library for the resvg SVG rendering library

Maintainer

Yukari Hafner <>

Author

Yukari Hafner <>

Home Page

https://shirakumo.github.io/cl-resvg/

Source Control

(GIT https://github.com/shirakumo/cl-resvg.git)

Bug Tracker

https://github.com/shirakumo/cl-resvg/issues

License

zlib

Version

1.0.0

Dependencies
  • documentation-utils (system).
  • float-features (system).
  • cffi (system).
Source

cl-resvg.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-resvg/cl-resvg.asd

Source

cl-resvg.asd.

Parent Component

cl-resvg (system).

ASDF Systems

cl-resvg.


3.1.2 cl-resvg/package.lisp

Source

cl-resvg.asd.

Parent Component

cl-resvg (system).

Packages

3.1.3 cl-resvg/low-level.lisp

Dependency

package.lisp (file).

Source

cl-resvg.asd.

Parent Component

cl-resvg (system).

Public Interface
Internals

3.1.4 cl-resvg/wrapper.lisp

Dependency

low-level.lisp (file).

Source

cl-resvg.asd.

Parent Component

cl-resvg (system).

Public Interface
Internals

3.1.5 cl-resvg/documentation.lisp

Dependency

wrapper.lisp (file).

Source

cl-resvg.asd.

Parent Component

cl-resvg (system).


4 Packages

Packages are listed by definition order.


4.1 org.shirakumo.fraf.resvg.cffi

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

4.2 org.shirakumo.fraf.resvg

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: with-image ((var source &rest init-options) &body body)

Convenience macro to lexically bind an image.

Calls INIT with the supplied options, then binds IMAGE to the result of MAKE-IMAGE on SOURCE. Upon exit of the BODY, calls FREE on the image.

See INIT
See IMAGE (type)
See MAKE-IMAGE
See FREE

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.


5.1.2 Ordinary functions

Function: bbox (image &optional node)

Returns the bounding box as an (X Y W H) list.

If NODE is given, it should be the ID of a node in the SVG tree. If no such node exists, an error of type RESVG-ERROR is signalled.

See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: create-options ()
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: destroy-options (options)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: destroy-tree (tree)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: empty-p (image)

Returns true if the image has no content.

See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: image-bbox (tree bbox)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: image-empty-p (tree)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: image-size (tree size)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: image-viewbox (tree rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: init (&key resources-dir dpi font-size fonts languages shape-rendering-mode text-rendering-mode image-rendering-mode)

Initializes the library.

It is safe to call this multiple times, especially to set different options.
Should be called before other functions are called.

The options are as follows:
resources-dir — The directory to locate relative paths from dpi — Sets the target DPI (default: 96) font-size — Sets the default font size (defalut: 12) fonts — Sets the default fonts. Should be a plist with the following keys, and the values being the name of the font-family to use. :DEFAULT
:SERIF
:SANS-SERIF
:CURSIVE
:FANTASY
:MONOSPACE
languages — Sets the system languages. Should be a comma-separated string shape-rendering-mode — Sets the rendering mode for shapes. Can be one of:
:OPTIMIZE-SPEED
:CRISP-EDGES
:GEOMETRIC-PRECISION
text-rendering-mode — Sets the rendering mode for text: Can be one of:
:OPTIMIZE-SPEED
:OPTIMIZE-LEGIBILITY
:GEOMETRIC-PRECISION
image-rendering-mode — Sets the rendering mode for images: Can be one of:
:OPTIMIZE-QUALITY
:OPTIMIZE-SPEED

See LOAD-FONT
See SHUTDOWN

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: init-log ()
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: load-font (source)

Load a font from a file or UB8 vector.

After loading, the font will be available to render in SVG images. Calls INIT if it wasn’t yet.

See INIT

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: load-font-data (options data length)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: load-font-file (options file)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: load-system-fonts (options)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: make-image (source)

Create a new SVG image from a data source.

SOURCE can either be a STRING or an UB8 vector for in-memory loading, or a PATHNAME to load from a file.

Calls INIT if it wasn’t yet.

Signals a RESVG-ERROR if the file couldn’t be parsed.

See INIT
See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: make-transform (&key x-offset y-offset scale x-scale y-scale angle)

Create a transform matrix.

X-OFFSET and Y-OFFSET represent a translation. X-SCALE and Y-SCALE represent a scaling. ANGLE represents a rotation.

See RENDER

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: node-bbox (tree id bbox)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: node-exists-p (tree id)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: node-p (image node)

Returns true if a node with the given ID exists.

See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: node-stroke-bbox (tree id bbox)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: node-transform (tree id transform)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: parse-from-data (data length options tree)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: parse-from-file (path options tree)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: rect-height (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: (setf rect-height) (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: rect-width (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: (setf rect-width) (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: rect-x (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: (setf rect-x) (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: rect-y (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: (setf rect-y) (pointer-to-rect)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: render (tree transform width height pixmap)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: render (image &key node output width height transform)

Render the image to a pixel buffer.

If NODE is given, it should be the ID of a node in the SVG tree. If no such node exists, an error of type RESVG-ERROR is signalled. If WIDTH or HEIGHT are not given, they are set to the dimensions of the image.
If OUTPUT is not given, an array of the appropriate size is created and returned for you.
If the TRANSFORM is given, it should be a 3x2 single-float simple-array vector, by which the image is transformed before output.

Returns three values:
The output pixel array
The width in pixels
The height in pixels

See IMAGE (type)
See MAKE-TRANSFORM
See RENDER-SCALED
See SIZE

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: render-node (tree id transform width height pixmap)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: render-scaled (image width height &key node output)

Render the image to a scaled output.

Either WIDTH or HEIGHT must be specified, setting the output image’s width or height. If one of the parameters is omitted, the other is computed based on the image’s aspect ratio and treating the specified size as a uniform scaling factor.

For the other parameters, see RENDER

See RENDER

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: set-cursive-family (options family)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-dpi (options dpi)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-fantasy-family (options family)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-font-family (options family)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-font-size (options size)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-image-rendering-mode (options mode)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-languages (options languages)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-monospace-family (options family)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-resources-dir (options path)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-sans-serif-family (options family)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-serif-family (options family)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-shape-rendering-mode (options mode)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: set-text-rendering-mode (options mode)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: shutdown ()

Uninitializes the library.

After calling this function you make not call any other functions except for INIT.
It is safe to call this multiple times.

See INIT

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: size (image &optional node)

Returns the size box as a (X . Y) cons.

If NODE is given, it should be the ID of a node in the SVG tree. If no such node exists, an error of type RESVG-ERROR is signalled.

See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: size-height (pointer-to-size)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: (setf size-height) (pointer-to-size)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: size-width (pointer-to-size)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: (setf size-width) (pointer-to-size)
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Function: transform (image node &optional transform)

Returns the transform matrix of the given node.

If no such node exists, an error of type RESVG-ERROR is signalled. The transform is a 3x2 single-float matrix. If no simple-array is passed, one is created and returned for you.

See MAKE-TRANSFORM
See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: viewbox (image)

Returns the view box as an (X Y W H) list.

See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.


5.1.3 Generic functions

Generic Reader: code (condition)

Returns the error code signalled by the underlying library.

See RESVG-ERROR

Package

org.shirakumo.fraf.resvg.

Methods
Reader Method: code ((condition resvg-error))
Source

wrapper.lisp.

Target Slot

code.

Generic Function: free (image)

Frees the image.

The object may not be used anymore after this. It is safe to call this multiple times.

See IMAGE (type)

Package

org.shirakumo.fraf.resvg.

Methods
Method: free ((image image))
Source

wrapper.lisp.


5.1.4 Standalone methods

Method: print-object ((image image) stream)
Source

wrapper.lisp.


5.1.5 Conditions

Condition: resvg-error

Error signalled when something goes wrong in the underlying library.

See CODE

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Direct superclasses

error.

Direct methods

code.

Direct slots
Slot: code
Initargs

:code

Readers

code.

Writers

This slot is read-only.


5.1.6 Structures

Structure: image

Representation of an SVG image.

See MAKE-IMAGE
See FREE
See EMPTY-P
See VIEWBOX
See SIZE
See BBOX
See NODE-P
See TRANSFORM
See RENDER

Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: ptr
Type

cffi-sys:foreign-pointer

Initform

(cffi-sys:null-pointer)

Readers

ptr.

Writers

(setf ptr).


5.2 Internals


5.2.1 Special variables

Special Variable: *here*
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Special Variable: *options*
Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Special Variable: *static*
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.


5.2.2 Ordinary functions

Function: %make-image (ptr)
Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: check-error (result)
Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: copy-image (instance)
Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Function: image-p (object)
Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Reader: ptr (instance)
Writer: (setf ptr) (instance)
Package

org.shirakumo.fraf.resvg.

Source

wrapper.lisp.

Target Slot

ptr.


5.2.3 Classes

Class: rect-tclass
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: size-tclass
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: transform-tclass
Package

org.shirakumo.fraf.resvg.cffi.

Source

low-level.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.

Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
B   C   D   E   F   G   I   L   M   N   P   R   S   T   V   W  
Index Entry  Section

%
%make-image: Private ordinary functions

(
(setf ptr): Private ordinary functions
(setf rect-height): Public ordinary functions
(setf rect-width): Public ordinary functions
(setf rect-x): Public ordinary functions
(setf rect-y): Public ordinary functions
(setf size-height): Public ordinary functions
(setf size-width): Public ordinary functions

B
bbox: Public ordinary functions

C
check-error: Private ordinary functions
code: Public generic functions
code: Public generic functions
copy-image: Private ordinary functions
create-options: Public ordinary functions

D
destroy-options: Public ordinary functions
destroy-tree: Public ordinary functions

E
empty-p: Public ordinary functions

F
free: Public generic functions
free: Public generic functions
Function, %make-image: Private ordinary functions
Function, (setf ptr): Private ordinary functions
Function, (setf rect-height): Public ordinary functions
Function, (setf rect-width): Public ordinary functions
Function, (setf rect-x): Public ordinary functions
Function, (setf rect-y): Public ordinary functions
Function, (setf size-height): Public ordinary functions
Function, (setf size-width): Public ordinary functions
Function, bbox: Public ordinary functions
Function, check-error: Private ordinary functions
Function, copy-image: Private ordinary functions
Function, create-options: Public ordinary functions
Function, destroy-options: Public ordinary functions
Function, destroy-tree: Public ordinary functions
Function, empty-p: Public ordinary functions
Function, image-bbox: Public ordinary functions
Function, image-empty-p: Public ordinary functions
Function, image-p: Private ordinary functions
Function, image-size: Public ordinary functions
Function, image-viewbox: Public ordinary functions
Function, init: Public ordinary functions
Function, init-log: Public ordinary functions
Function, load-font: Public ordinary functions
Function, load-font-data: Public ordinary functions
Function, load-font-file: Public ordinary functions
Function, load-system-fonts: Public ordinary functions
Function, make-image: Public ordinary functions
Function, make-transform: Public ordinary functions
Function, node-bbox: Public ordinary functions
Function, node-exists-p: Public ordinary functions
Function, node-p: Public ordinary functions
Function, node-stroke-bbox: Public ordinary functions
Function, node-transform: Public ordinary functions
Function, parse-from-data: Public ordinary functions
Function, parse-from-file: Public ordinary functions
Function, ptr: Private ordinary functions
Function, rect-height: Public ordinary functions
Function, rect-width: Public ordinary functions
Function, rect-x: Public ordinary functions
Function, rect-y: Public ordinary functions
Function, render: Public ordinary functions
Function, render: Public ordinary functions
Function, render-node: Public ordinary functions
Function, render-scaled: Public ordinary functions
Function, set-cursive-family: Public ordinary functions
Function, set-dpi: Public ordinary functions
Function, set-fantasy-family: Public ordinary functions
Function, set-font-family: Public ordinary functions
Function, set-font-size: Public ordinary functions
Function, set-image-rendering-mode: Public ordinary functions
Function, set-languages: Public ordinary functions
Function, set-monospace-family: Public ordinary functions
Function, set-resources-dir: Public ordinary functions
Function, set-sans-serif-family: Public ordinary functions
Function, set-serif-family: Public ordinary functions
Function, set-shape-rendering-mode: Public ordinary functions
Function, set-text-rendering-mode: Public ordinary functions
Function, shutdown: Public ordinary functions
Function, size: Public ordinary functions
Function, size-height: Public ordinary functions
Function, size-width: Public ordinary functions
Function, transform: Public ordinary functions
Function, viewbox: Public ordinary functions

G
Generic Function, code: Public generic functions
Generic Function, free: Public generic functions

I
image-bbox: Public ordinary functions
image-empty-p: Public ordinary functions
image-p: Private ordinary functions
image-size: Public ordinary functions
image-viewbox: Public ordinary functions
init: Public ordinary functions
init-log: Public ordinary functions

L
load-font: Public ordinary functions
load-font-data: Public ordinary functions
load-font-file: Public ordinary functions
load-system-fonts: Public ordinary functions

M
Macro, with-image: Public macros
make-image: Public ordinary functions
make-transform: Public ordinary functions
Method, code: Public generic functions
Method, free: Public generic functions
Method, print-object: Public standalone methods

N
node-bbox: Public ordinary functions
node-exists-p: Public ordinary functions
node-p: Public ordinary functions
node-stroke-bbox: Public ordinary functions
node-transform: Public ordinary functions

P
parse-from-data: Public ordinary functions
parse-from-file: Public ordinary functions
print-object: Public standalone methods
ptr: Private ordinary functions

R
rect-height: Public ordinary functions
rect-width: Public ordinary functions
rect-x: Public ordinary functions
rect-y: Public ordinary functions
render: Public ordinary functions
render: Public ordinary functions
render-node: Public ordinary functions
render-scaled: Public ordinary functions

S
set-cursive-family: Public ordinary functions
set-dpi: Public ordinary functions
set-fantasy-family: Public ordinary functions
set-font-family: Public ordinary functions
set-font-size: Public ordinary functions
set-image-rendering-mode: Public ordinary functions
set-languages: Public ordinary functions
set-monospace-family: Public ordinary functions
set-resources-dir: Public ordinary functions
set-sans-serif-family: Public ordinary functions
set-serif-family: Public ordinary functions
set-shape-rendering-mode: Public ordinary functions
set-text-rendering-mode: Public ordinary functions
shutdown: Public ordinary functions
size: Public ordinary functions
size-height: Public ordinary functions
size-width: Public ordinary functions

T
transform: Public ordinary functions

V
viewbox: Public ordinary functions

W
with-image: Public macros


A.4 Data types