22 lines
582 B
Python
22 lines
582 B
Python
|
from svgpathtools import svg2paths
|
||
|
import struct, time
|
||
|
|
||
|
|
||
|
PIPE_NAME = "qvnjernldscd"
|
||
|
PIPE_PATH = "/tmp/" + PIPE_NAME
|
||
|
DATA_PATH = "./data.c"
|
||
|
|
||
|
paths, attrs = svg2paths('../grandma.svg')
|
||
|
|
||
|
def draw(f, x, y, x2, y2):
|
||
|
# f.write(struct.pack("iiii", int(x),int(y),int(x2),int(y2)))
|
||
|
f.write(f"({int(x)},{int(y)},{int(x2)},{int(y2)}),\n")
|
||
|
|
||
|
with open(DATA_PATH, 'w') as f:
|
||
|
for path in paths:
|
||
|
print(type(path))
|
||
|
for e in path:
|
||
|
draw(f, e.start.real / 2, e.start.imag / 2, e.end.real / 2, e.end.imag / 2)
|
||
|
#time.sleep(0.01)
|
||
|
#f.flush()
|