Merge pull request #1 from brantai/master
Updating for changes in drawsvg 2.0
This commit is contained in:
commit
ae7b95396d
2 changed files with 6 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
width="400" height="400" viewBox="-200.0 -200.0 400 400">
|
width="400" height="400" viewBox="-200.0 -200.0 400.0 400.0">
|
||||||
<defs>
|
<defs>
|
||||||
<marker markerWidth="6.5" markerHeight="5.0" viewBox="-0.8 -0.5 1.3 1.0" orient="auto" id="d0">
|
<marker markerWidth="6.5" markerHeight="5.0" viewBox="-0.8 -0.5 1.3 1.0" orient="auto" id="d0">
|
||||||
<circle cx="-0.3" cy="-0.0" r="0.3" stroke-width="0.2" stroke="black" fill="none" />
|
<circle cx="-0.3" cy="-0.0" r="0.3" stroke-width="0.2" stroke="black" fill="none" />
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 767 B |
10
sigilize.py
10
sigilize.py
|
|
@ -24,7 +24,7 @@ SOFTWARE.
|
||||||
import sys
|
import sys
|
||||||
import math
|
import math
|
||||||
import re
|
import re
|
||||||
import drawSvg as svg
|
import drawsvg as svg
|
||||||
|
|
||||||
def prepareMessage(message):
|
def prepareMessage(message):
|
||||||
message = re.sub("[^a-zA-Z]+", "", message) # get rid of all non-alphabetic characters
|
message = re.sub("[^a-zA-Z]+", "", message) # get rid of all non-alphabetic characters
|
||||||
|
|
@ -128,7 +128,7 @@ def drawSigil(points, canvas, color='white'): # draw sigil from coordinate list
|
||||||
else:
|
else:
|
||||||
x = point[0] - originX # abs. to rel. coords
|
x = point[0] - originX # abs. to rel. coords
|
||||||
y = point[1] - originY # abs. to rel. coords
|
y = point[1] - originY # abs. to rel. coords
|
||||||
p.l(x, y) # draw
|
p.l(x,y) # draw
|
||||||
originX = point[0]
|
originX = point[0]
|
||||||
originY = point[1]
|
originY = point[1]
|
||||||
|
|
||||||
|
|
@ -140,7 +140,7 @@ def createSigil(message, planet, fileName):
|
||||||
planets = ["moon", "mercury", "venus", "sun", "mars", "jupiter", "saturn"]
|
planets = ["moon", "mercury", "venus", "sun", "mars", "jupiter", "saturn"]
|
||||||
planet = planets.index(planet.lower())
|
planet = planets.index(planet.lower())
|
||||||
# set up SVG canvas
|
# set up SVG canvas
|
||||||
d = svg.Drawing(400, 400, origin='center') # define canvas
|
d = svg.Drawing(400, 400, origin='center', context=svg.Context(invert_y=True)) # define canvas
|
||||||
|
|
||||||
# draw sigils
|
# draw sigils
|
||||||
message = prepareMessage(message)
|
message = prepareMessage(message)
|
||||||
|
|
@ -149,7 +149,7 @@ def createSigil(message, planet, fileName):
|
||||||
drawSigil( coordList, d, "black")
|
drawSigil( coordList, d, "black")
|
||||||
|
|
||||||
# save sigil to SVG file
|
# save sigil to SVG file
|
||||||
d.saveSvg(fileName)
|
d.save_svg(fileName)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argNo = len(sys.argv) - 1
|
argNo = len(sys.argv) - 1
|
||||||
|
|
@ -163,4 +163,4 @@ def main():
|
||||||
print("--------------------------------------------")
|
print("--------------------------------------------")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue