File: svg.el.html

This package allows creating SVG images in Emacs. SVG images are vector-based XML files, really, so you could create them directly as XML. However, that's really tedious, as there are some fiddly bits.

In addition, the svg-insert-image function allows inserting an SVG image into a buffer that's updated "on the fly" as you add/alter elements to the image, which is useful when composing the images.

Here are some usage examples:

Create the base image structure, add a gradient spec, and insert it into the buffer:

    (setq svg (svg-create 800 800 :stroke "orange" :stroke-width 5))
    (svg-gradient svg "gradient" 'linear '((0 . "red") (100 . "blue")))
    (save-excursion (goto-char (point-max)) (svg-insert-image svg))

Then add various elements to the structure:

    (svg-rectangle svg 100 100 500 500 :gradient "gradient" :id "rec1") (svg-circle svg 500 500 100 :id "circle1") (svg-ellipse svg 100 100 50 90 :stroke "red" :id "ellipse1") (svg-line svg 100 190 50 100 :id "line1" :stroke "yellow") (svg-polyline svg '((200 . 100) (500 . 450) (80 . 100)) :stroke "green" :id "poly1") (svg-polygon svg '((100 . 100) (200 . 150) (150 . 90)) :stroke "blue" :fill "red" :id "gon1")

Defined variables (0)

Defined functions (38)

svg--append(SVG NODE)
svg--arguments(SVG ARGS)
svg--closepath-command(&rest ARGS)
svg--curveto-command(COORDINATES-LIST &rest ARGS)
svg--def(SVG DEF)
svg--elliptical-arc-command(COORDINATES-LIST &rest ARGS)
svg--elliptical-arc-coordinates(RX RY X Y &rest ARGS)
svg--encode-text(TEXT)
svg--eval-path-command(COMMAND DEFAULT-RELATIVE)
svg--horizontal-lineto-command(COORDINATE-LIST &rest ARGS)
svg--image-data(IMAGE IMAGE-TYPE DATAP)
svg--lineto-command(COORDINATES-LIST &rest ARGS)
svg--moveto-command(COORDINATES-LIST &rest ARGS)
svg--path-command-symbol(COMMAND-SYMBOL COMMAND-ARGS)
svg--plist-delete(PLIST PROPERTY)
svg--quadratic-bezier-curveto-command(COORDINATES-LIST &rest ARGS)
svg--smooth-curveto-command(COORDINATES-LIST &rest ARGS)
svg--smooth-quadratic-bezier-curveto-command(COORDINATES-LIST &rest ARGS)
svg--vertical-lineto-command(COORDINATE-LIST &rest ARGS)
svg-circle(SVG X Y RADIUS &rest ARGS)
svg-clip-path(SVG &rest ARGS)
svg-create(WIDTH HEIGHT &rest ARGS)
svg-ellipse(SVG X Y X-RADIUS Y-RADIUS &rest ARGS)
svg-embed(SVG IMAGE IMAGE-TYPE DATAP &rest ARGS)
svg-embed-base-uri-image(SVG RELATIVE-FILENAME &rest ARGS)
svg-gradient(SVG ID TYPE STOPS)
svg-image(SVG &rest PROPS)
svg-insert-image(SVG)
svg-line(SVG X1 Y1 X2 Y2 &rest ARGS)
svg-node(SVG TAG &rest ARGS)
svg-path(SVG COMMANDS &rest ARGS)
svg-polygon(SVG POINTS &rest ARGS)
svg-polyline(SVG POINTS &rest ARGS)
svg-possibly-update-image(SVG)
svg-print(DOM)
svg-rectangle(SVG X Y WIDTH HEIGHT &rest ARGS)
svg-remove(SVG ID)
svg-text(SVG TEXT &rest ARGS)

Defined faces (0)