本文整理汇总了Python中Transform.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.reset方法的具体用法?Python Transform.reset怎么用?Python Transform.reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Context
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import reset [as 别名]
#.........这里部分代码省略.........
#if draw == True:
self.cairoContext.stroke()
self.cairoContext.restore()
#### Transform and utility
# ----- Transform and utility -----
# TODO
def beginclip(self,x,y,w,h):
self.save()
self.context.rectangle(x, y, w, h)
self.context.clip()
# TODO
def endclip(self):
self.restore()
def translate(self, x, y):
self._transform.translate( x, y)
def rotate(self, degrees=0, radians=0):
self._transform.rotate( degrees, radians)
# TODO - to check
def scale(self, x=1, y=None):
if x == 0 or y == 0:
print "Warning: Invalid matrix provided to scale(), values of 0 not allowed. Ignoring."
pass
elif y is None:
self.context.scale(x,x)
else:
self.context.scale(x,y)
def reset(self):
#self.context.identity_matrix()
self._transform.reset()
# TODO - doesn't work
def skew(self, x=1, y=None):
if x in (-1,1):
print "Warning: Invalid value provided to scale(), values of -1, or -1 not allowed. Setting value to 0."
x = 0
if y in (-1,1):
print "Warning: Invalid value provided to scale(), values of -1, or -1 not allowed. Setting value to 0."
y = 0
elif y is None:
y = x
mtrx = cairo.Matrix (xx=1.0, yx=y, xy=x, yy=1.0, x0=0.0, y0=0.0)
self.cairoContext.transform(mtrx)
else:
mtrx = cairo.Matrix (xx=1.0, yx=y, xy=x, yy=1.0, x0=0.0, y0=0.0)
self.cairoContext.transform(mtrx)
# TODO - to check
def push(self):
#self.push_group()
self.cairoContext.save()
# TODO - to check
def pop(self):
#self.pop_group()
self.cairoContext.restore()
# ----- UTILITY -----
# TODO - to check