3 API Reference
dxtr edited this page 2026-10-18 16:44:24 +02:00

API Reference

Every exported symbol, by package. The docstrings say more.

cl-svgread

Reading

Symbol Kind What it is
read-svg source function Read an SVG document from a pathname, a string of SVG, a stream or octets, and return its drawing. See Reading SVG.

Drawings

Symbol Kind What it is
drawing structure An SVG document as read-svg reads it.
drawing-p object function True for a drawing.
drawing-width, drawing-height drawing functions Its size, in px.
drawing-view-box drawing function Its view box, #(min-x min-y width height), or nil.
drawing-shapes drawing function Its shapes, a simple vector in paint order.

Shapes

Symbol Kind What it is
shape structure A path element or basic shape, ready to draw. See Drawings and Shapes.
shape-p object function True for a shape.
shape-path shape function Its path, in its own coordinates.
shape-transform shape function The transform from its coordinates to the drawing's.
shape-fill, shape-stroke shape functions Its fill's and stroke's paint.
shape-fill-opacity, shape-stroke-opacity shape functions Their opacities, from 0 to 1.
shape-fill-rule shape function Its fill-rule.
shape-stroke-width shape function The stroke's width, in its own coordinates.
shape-stroke-line-join shape function The stroke's line-join.
shape-stroke-line-cap shape function The stroke's line-cap.
shape-stroke-miter-limit shape function The stroke's miter limit, at least 1.
shape-paint-order shape function Its paint-order.
shape-id shape function Its element's id, or nil.
shape-bounds shape function The box around what it paints, stroke included, in the drawing's coordinates: xmin ymin xmax ymax.

Paths

Symbol Kind What it is
path structure A shape's curves, as plain arrays. See Paths.
path-p object function True for a path.
path-points path function Two single-floats for each point, x then y.
path-tags path function An octet for each point: one of the three tags below.
path-contour-ends path function The index of each contour's last point.
path-closed path function A bit vector, 1 for each closed contour.
+on-curve+ constant 1, the tag of a point the path passes through.
+quadratic-control+ constant 0, the tag of a quadratic curve's control point.
+cubic-control+ constant 2, the tag of each of a cubic curve's control points.
path-contours path &key closed function The contours as lists of :line, :quadratic and :cubic segments, and which are closed.
path-bounds path &optional transform function The box around its points: xmin ymin xmax ymax; an svg-error where a transform takes it beyond single-floats.
path-point-count, path-contour-count path functions How many points and contours it has.

Types

Symbol What it is
color Four single-floats from 0 to 1, red, green, blue and alpha, sRGB, straight alpha.
paint nil, a color, or :current-color.
transform Six single-floats #(a b c d e f), as SVG's matrix() and cl-gmath's mat3x2.
fill-rule :nonzero or :even-odd.
line-join :miter, :miter-clip, :round or :bevel.
line-cap :butt, :round or :square.
paint-order :fill-stroke or :stroke-fill.

Conditions

Symbol Kind What it is
svg-error condition Every error: input that is not SVG or is malformed, or a shape FreeType cannot rasterize. See Errors and Warnings.
svg-error-message, svg-error-location error functions What is wrong and where, and the element alone.
svg-warning condition A part of SVG left out or approximated.
svg-warning-message, svg-warning-location warning functions What was left out and what was done instead, and the element.

cl-svgread/ft2

Symbol Kind What it is
rasterize drawing &key scale width height current-color alpha function Draw drawing into an RGBA image with FreeType, and return the image, its width and its height. See Rasterizing.
rgba type A colour as rasterize takes one: four reals from 0 to 1, red, green, blue and alpha, as a list or a vector.