Fixed double offset drawing bug
This commit is contained in:
parent
a10db57a8d
commit
b46c6e599b
43
svlgui.py
43
svlgui.py
|
|
@ -53,6 +53,9 @@ if GLEnablable:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
USING_GL = False
|
USING_GL = False
|
||||||
|
|
||||||
|
# Disable OpenGL. It's not ready for prime time.
|
||||||
|
USING_GL = False
|
||||||
|
|
||||||
#Object which has the keyboard focus.
|
#Object which has the keyboard focus.
|
||||||
FOCUS = None
|
FOCUS = None
|
||||||
|
|
||||||
|
|
@ -1525,6 +1528,7 @@ class Shape (object):
|
||||||
# Coordinate transform: multiplication by a rotation matrix
|
# Coordinate transform: multiplication by a rotation matrix
|
||||||
cr.translate(self.x*math.cos(radrot)-self.y*math.sin(radrot), self.x*math.sin(radrot)+self.y*math.cos(radrot))
|
cr.translate(self.x*math.cos(radrot)-self.y*math.sin(radrot), self.x*math.sin(radrot)+self.y*math.cos(radrot))
|
||||||
else:
|
else:
|
||||||
|
pass
|
||||||
cr.translate(self.x,self.y)
|
cr.translate(self.x,self.y)
|
||||||
cr.rotate(self.rotation)
|
cr.rotate(self.rotation)
|
||||||
cr.scale(self.xscale*1.0, self.yscale*1.0)
|
cr.scale(self.xscale*1.0, self.yscale*1.0)
|
||||||
|
|
@ -1550,43 +1554,8 @@ class Shape (object):
|
||||||
cr.fill_stroke()
|
cr.fill_stroke()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
cr.gsave()
|
cr.stroke()
|
||||||
if sep=="\\":
|
cr.grestore()
|
||||||
# Very ugly hack for Windows. :(
|
|
||||||
# Windows doesn't respect coordinate transformations
|
|
||||||
# with respect to translation, so we have to do this
|
|
||||||
# bit ourselves.
|
|
||||||
|
|
||||||
# Rotation in radians
|
|
||||||
radrot = parent.group.rotation*math.pi/180
|
|
||||||
# Coordinate transform: multiplication by a rotation matrix
|
|
||||||
cr.translate(self.x*math.cos(radrot)-self.y*math.sin(radrot), self.x*math.sin(radrot)+self.y*math.cos(radrot))
|
|
||||||
else:
|
|
||||||
cr.translate(self.x,self.y)
|
|
||||||
cr.rotate(self.rotation)
|
|
||||||
cr.scale(self.xscale*1.0, self.yscale*1.0)
|
|
||||||
cr.newpath()
|
|
||||||
cr.pencolor = self.linecolor.pygui
|
|
||||||
cr.fillcolor = self.fillcolor.pygui
|
|
||||||
for i in self.shapedata:
|
|
||||||
if i[0]=="M":
|
|
||||||
point = (i[1], i[2])
|
|
||||||
cr.moveto(point[0],point[1])
|
|
||||||
elif i[0]=="L":
|
|
||||||
point = (i[1], i[2])
|
|
||||||
cr.lineto(point[0],point[1])
|
|
||||||
elif i[0]=="C":
|
|
||||||
pointa = (i[1], i[2])
|
|
||||||
pointb = (i[3], i[4])
|
|
||||||
pointc = (i[5], i[6])
|
|
||||||
### Mac OSX needs custom PyGUI for this to work ###
|
|
||||||
cr.curveto((pointa[0],pointa[1]),(pointb[0],pointb[1]),(pointc[0],pointc[1]))
|
|
||||||
if self.filled:
|
|
||||||
cr.closepath()
|
|
||||||
cr.fill_stroke()
|
|
||||||
else:
|
|
||||||
cr.stroke()
|
|
||||||
cr.grestore()
|
|
||||||
elif SYSTEM=="html":
|
elif SYSTEM=="html":
|
||||||
tb = ""
|
tb = ""
|
||||||
tb+="cr.save()\n"
|
tb+="cr.save()\n"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue