From: "Felix E. Klee" <felix.klee@inka.de>
To: 32359@debbugs.gnu.org
Subject: bug#32359: [PATCH] Add svg-path
Date: Fri, 3 Aug 2018 13:07:42 +0200 [thread overview]
Message-ID: <CA+m_8J10a5WE8-p+UcQ7XAjw1B_VVEjtyg320fcHxS6nf-uVow@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 215 bytes --]
The patch adds `svg-path'. Among other things, this function makes it
possible to add arcs to SVG images. A path is drawn using commands
defined by the SVG standard:
https://www.w3.org/TR/SVG11/paths.html#PathData
[-- Attachment #2: add-svg-path.patch --]
[-- Type: application/octet-stream, Size: 1784 bytes --]
diff --git a/ChangeLog.3 b/ChangeLog.3
index a0a4794b4e..2a9832b67b 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1,3 +1,7 @@
+2018-08-03 Felix E. Klee <felix.klee@inka.de>
+
+ * lisp/svg.el (svg-path): New function.
+
2018-07-01 Paul Eggert <eggert@cs.ucla.edu>
* etc/HISTORY: Cite Brinkhoff on early history.
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index fef5188197..d45f68d95b 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -5541,6 +5541,19 @@ that describe the outer circumference of the polygon.
@end lisp
@end defun
+@defun svg-path svg commands &rest args
+Add the outline of a shape to @var{svg}. The @var{commands} follow the
+Scalable Vector Graphics standard. This function can be used to create
+arcs.
+
+@lisp
+(svg-path svg '((M 100 300)
+ (A 300 300 0 0 0 300 100)
+ (Z))
+ :stroke-color "blue" :fill-color "yellow")
+@end lisp
+@end defun
+
@defun svg-text svg text &rest args
Add a text to @var{svg}.
diff --git a/lisp/svg.el b/lisp/svg.el
index 1178905546..e5c4e1383a 100644
--- a/lisp/svg.el
+++ b/lisp/svg.el
@@ -138,6 +138,17 @@ POINTS is a list of x/y pairs."
", "))
,@(svg--arguments svg args)))))
+(defun svg-path (svg commands &rest args)
+ "Add the outline of a shape to SVG. The COMMANDS follow the
+Scalable Vector Graphics standard. This function can be used to
+create arcs."
+ (let ((d (mapconcat 'prin1-to-string (apply 'append commands) " ")))
+ (svg--append
+ svg
+ (dom-node 'path
+ `((d . ,d)
+ ,@(svg--arguments svg args))))))
+
(defun svg-embed (svg image image-type datap &rest args)
"Insert IMAGE into the SVG structure.
IMAGE should be a file name if DATAP is nil, and a binary string
next reply other threads:[~2018-08-03 11:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 11:07 Felix E. Klee [this message]
2018-08-03 13:05 ` bug#32359: [PATCH] Add svg-path Eli Zaretskii
2018-08-23 15:50 ` Felix E. Klee
2018-08-23 17:23 ` Eli Zaretskii
2018-08-24 9:15 ` Felix E. Klee
2019-06-23 22:15 ` Lars Ingebrigtsen
2019-06-24 14:32 ` Felix E. Klee
2019-06-24 14:39 ` Lars Ingebrigtsen
2019-07-12 14:35 ` Felix E. Klee
2019-07-12 16:02 ` Lars Ingebrigtsen
2019-07-15 13:34 ` Felix E. Klee
2019-07-15 15:12 ` Lars Ingebrigtsen
2019-07-15 20:40 ` Felix E. Klee
2019-07-15 20:48 ` Noam Postavsky
2019-07-16 10:32 ` Felix E. Klee
2019-07-15 21:13 ` Felix E. Klee
2019-07-16 6:05 ` Lars Ingebrigtsen
2019-07-16 10:31 ` Felix E. Klee
2019-07-16 13:46 ` Lars Ingebrigtsen
2019-07-24 7:49 ` Felix E. Klee
2019-07-24 14:30 ` Eli Zaretskii
2019-07-30 17:46 ` Felix E. Klee
2019-07-31 20:31 ` Lars Ingebrigtsen
2019-08-01 13:23 ` Felix E. Klee
2019-08-02 6:40 ` Eli Zaretskii
2019-08-02 10:43 ` Felix E. Klee
2019-08-02 11:57 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+m_8J10a5WE8-p+UcQ7XAjw1B_VVEjtyg320fcHxS6nf-uVow@mail.gmail.com \
--to=felix.klee@inka.de \
--cc=32359@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).