branch: master commit f9989d3f023079c48ba1115c271d0d262b0813d5 Author: Lars Magne Ingebrigtsen <la...@gnus.org> Date: Mon Dec 1 17:34:30 2014 +0100
Move the SVG examples to the svg.el file --- packages/svg/README | 13 ------------- packages/svg/svg.el | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/packages/svg/README b/packages/svg/README deleted file mode 100644 index 953018a..0000000 --- a/packages/svg/README +++ /dev/null @@ -1,13 +0,0 @@ -The svg package allows creating SVG images in Emacs. - -(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)) -(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") diff --git a/packages/svg/svg.el b/packages/svg/svg.el index aa5b076..bf9ad34 100644 --- a/packages/svg/svg.el +++ b/packages/svg/svg.el @@ -21,6 +21,34 @@ ;;; Commentary: +;; This pacakge 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") + ;;; Code: (require 'cl-lib)