Пример #1
0
def save():
	global do_save,draw
	draw= vp3rw.vp3(producer,settings)
	do_save=1
	redraw1()
	fname_nr=int(divv1 * 100)
	fname="spiro1-%d.vp3" % fname_nr
	draw.flush(fname)
	print "saved: ",fname
	do_save=0
Пример #2
0
 def export_vp3(self, dbg):
     vp3o = vp3rw.vp3("inkscape plugin", "settings")
     lastColor = ""
     # for stitch in self.coords[1:]:
     for stitch in self.coords:
         if stitch.color != lastColor:
             vp3o.setcolor(stitch.color)
             lastColor = stitch.color
         p = stitch.as_int()
         # if stitch.cmd=="m":
         # 	vp3o.lineto(p.x,p.y,1) # long
         # else:
         vp3o.lineto(p.x, p.y)
     return vp3o.flush_str()
Пример #3
0
class flower:
	def __init__(self, draw_fn):
		self.drawfn=draw_fn
	def draw(self,cx,cy):
		self.drawfn.moveto(cx+4,cy+5)
		self.drawfn.lineto(cx+2,cy+3)
		self.drawfn.lineto(cx+5,cy+6)
		self.drawfn.lineto(cx-5,cy+6)
		self.drawfn.lineto(cx-5,cy-6)


# vp3 format requires some strings
producer="testing"
settings="settings"

testdraw= vp3rw.vp3(producer,settings)

rose=flower(testdraw)
shape=squares(testdraw)

color="#ffff00"
testdraw.setcolor(color)
shape.draw(10,10,20,3,7)
shape.draw(80,30,15,2,9)
shape.draw(0,70,7,2,5)
shape.draw(50,80,7,3,6)

color="#0000ff"
testdraw.setcolor(color)
shape.draw(200,190,7,2,5)
shape.draw(250,190,7,3,6)