本文整理匯總了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