[cairo-commit] [cairo-www] src/svgtopycairo.mdwn
Carl Worth
cworth at freedesktop.org
Thu Nov 8 08:59:25 PST 2007
src/svgtopycairo.mdwn | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit dbb92be207718ec68524e8c7d75c4fbbc6eca745
Author: Donn <donn.ingle at gmail.com>
Date: Thu Nov 8 08:59:24 2007 -0800
Fixed a bug.
diff --git a/src/svgtopycairo.mdwn b/src/svgtopycairo.mdwn
index 2c7ed5c..552a76b 100644
--- a/src/svgtopycairo.mdwn
+++ b/src/svgtopycairo.mdwn
@@ -4,6 +4,8 @@ This took a while, the pyparsing had me in knots, but now it's short and sweet.
Make sure you pass it a very simple SVG file -- one that has had all the shapes reduced to paths. Oh, and keep your canvas 400 by 400 or it may draw clear off the screen.
It re-uses the framework from my other recipe. You should be able to copy/paste and run, but you may need elementree and pyparsing first.
+Please forgive any bugs.
+
#!/usr/bin/env python
"""\
@@ -95,13 +97,14 @@ It re-uses the framework from my other recipe. You should be able to copy/paste
if command == "Z":
cairo_commands += "ctx.close_path();"
- command_list.append(cairo_commands) #Add them to the list
-
+ command_list.append(cairo_commands) #Add them to the list
+ cairo_commands = ""
#Draw it. Only stroked, to fill as per the SVG drawing is another whole story.
ctx.set_source_rgb(1,0,0)
for c in command_list:
exec(c)
ctx.stroke()
+
#Check args:
if len(sys.argv) < 2:
More information about the cairo-commit
mailing list