cl resvg
1.0.0An up-to-date bindings library for the resvg SVG rendering library
About cl-resvg
This is a small bindings library to resvg, a Rust library to render SVG images to bitmaps. It can be used as a standalone way to display SVG images.
How To
First, init
ialise the library with whatever options you would like to use. We assume org.shirakumo.fraf.resvg
is locally nicknamed to resvg
.
(resvg:init)
You can then load an image from an in-memory buffer, string, or a file using make-image
:
(resvg:make-image #p"my-image.svg")
If the image loads successfully, you can then query it with empty-p
, viewbox
, size
, bbox
, node-p
, and transform
. Finally, you can use render
to render the image to a bitmap.
(resvg:render *)
Once you are done using the image, make sure you clean it up with free
. For more convenient operations, you can also use the with-image
macro.
(resvg:free **)
Once you are completely done with the library, you should call shutdown
to uninitialise it.
System Information
Definition Index
-
ORG.SHIRAKUMO.FRAF.RESVG
No documentation provided.-
EXTERNAL CONDITION RESVG-ERROR
Error signalled when something goes wrong in the underlying library. See CODE
-
EXTERNAL STRUCTURE IMAGE
-
EXTERNAL 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)
-
EXTERNAL FUNCTION EMPTY-P
- IMAGE
Returns true if the image has no content. See IMAGE (type)
-
EXTERNAL 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
-
EXTERNAL 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
-
EXTERNAL 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)
-
EXTERNAL FUNCTION NODE-P
- IMAGE
- NODE
Returns true if a node with the given ID exists. See IMAGE (type)
-
EXTERNAL 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. See IMAGE (type) See SIZE
-
EXTERNAL 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
-
EXTERNAL 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)
-
EXTERNAL 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 IMAGE (type)
-
EXTERNAL FUNCTION VIEWBOX
- IMAGE
Returns the view box as an (X Y W H) list. See IMAGE (type)
-
EXTERNAL GENERIC-FUNCTION CODE
- CONDITION
Returns the error code signalled by the underlying library. See RESVG-ERROR
-
EXTERNAL 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)
-
EXTERNAL 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
-
-
ORG.SHIRAKUMO.FRAF.RESVG.CFFI
No documentation provided.-
EXTERNAL FUNCTION CREATE-OPTIONS
No documentation provided. -
EXTERNAL FUNCTION DESTROY-OPTIONS
- OPTIONS
No documentation provided. -
EXTERNAL FUNCTION DESTROY-TREE
- TREE
No documentation provided. -
EXTERNAL FUNCTION IMAGE-BBOX
- TREE
- BBOX
No documentation provided. -
EXTERNAL FUNCTION IMAGE-EMPTY-P
- TREE
No documentation provided. -
EXTERNAL FUNCTION IMAGE-SIZE
- TREE
- SIZE
No documentation provided. -
EXTERNAL FUNCTION IMAGE-VIEWBOX
- TREE
- RECT
No documentation provided. -
EXTERNAL FUNCTION INIT-LOG
No documentation provided. -
EXTERNAL FUNCTION LOAD-FONT-DATA
- OPTIONS
- DATA
- LENGTH
No documentation provided. -
EXTERNAL FUNCTION LOAD-FONT-FILE
- OPTIONS
- FILE
No documentation provided. -
EXTERNAL FUNCTION LOAD-SYSTEM-FONTS
- OPTIONS
No documentation provided. -
EXTERNAL FUNCTION NODE-BBOX
- TREE
- ID
- BBOX
No documentation provided. -
EXTERNAL FUNCTION NODE-EXISTS-P
- TREE
- ID
No documentation provided. -
EXTERNAL FUNCTION NODE-STROKE-BBOX
- TREE
- ID
- BBOX
No documentation provided. -
EXTERNAL FUNCTION NODE-TRANSFORM
- TREE
- ID
- TRANSFORM
No documentation provided. -
EXTERNAL FUNCTION PARSE-FROM-DATA
- DATA
- LENGTH
- OPTIONS
- TREE
No documentation provided. -
EXTERNAL FUNCTION PARSE-FROM-FILE
- PATH
- OPTIONS
- TREE
No documentation provided. -
EXTERNAL FUNCTION RECT-HEIGHT
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION (SETF RECT-HEIGHT)
- VALUE
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION RECT-WIDTH
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION (SETF RECT-WIDTH)
- VALUE
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION RECT-X
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION (SETF RECT-X)
- VALUE
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION RECT-Y
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION (SETF RECT-Y)
- VALUE
- POINTER-TO-RECT
No documentation provided. -
EXTERNAL FUNCTION RENDER
- TREE
- TRANSFORM
- WIDTH
- HEIGHT
- PIXMAP
No documentation provided. -
EXTERNAL FUNCTION RENDER-NODE
- TREE
- ID
- TRANSFORM
- WIDTH
- HEIGHT
- PIXMAP
No documentation provided. -
EXTERNAL FUNCTION SET-CURSIVE-FAMILY
- OPTIONS
- FAMILY
No documentation provided. -
EXTERNAL FUNCTION SET-DPI
- OPTIONS
- DPI
No documentation provided. -
EXTERNAL FUNCTION SET-FANTASY-FAMILY
- OPTIONS
- FAMILY
No documentation provided. -
EXTERNAL FUNCTION SET-FONT-FAMILY
- OPTIONS
- FAMILY
No documentation provided. -
EXTERNAL FUNCTION SET-FONT-SIZE
- OPTIONS
- SIZE
No documentation provided. -
EXTERNAL FUNCTION SET-IMAGE-RENDERING-MODE
- OPTIONS
- MODE
No documentation provided. -
EXTERNAL FUNCTION SET-LANGUAGES
- OPTIONS
- LANGUAGES
No documentation provided. -
EXTERNAL FUNCTION SET-MONOSPACE-FAMILY
- OPTIONS
- FAMILY
No documentation provided. -
EXTERNAL FUNCTION SET-RESOURCES-DIR
- OPTIONS
- PATH
No documentation provided. -
EXTERNAL FUNCTION SET-SANS-SERIF-FAMILY
- OPTIONS
- FAMILY
No documentation provided. -
EXTERNAL FUNCTION SET-SERIF-FAMILY
- OPTIONS
- FAMILY
No documentation provided. -
EXTERNAL FUNCTION SET-SHAPE-RENDERING-MODE
- OPTIONS
- MODE
No documentation provided. -
EXTERNAL FUNCTION SET-TEXT-RENDERING-MODE
- OPTIONS
- MODE
No documentation provided. -
EXTERNAL FUNCTION SIZE-HEIGHT
- POINTER-TO-SIZE
No documentation provided. -
EXTERNAL FUNCTION (SETF SIZE-HEIGHT)
- VALUE
- POINTER-TO-SIZE
No documentation provided. -
EXTERNAL FUNCTION SIZE-WIDTH
- POINTER-TO-SIZE
No documentation provided. -
EXTERNAL FUNCTION (SETF SIZE-WIDTH)
- VALUE
- POINTER-TO-SIZE
No documentation provided.
-