本文整理汇总了Python中Transform.rotate方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.rotate方法的具体用法?Python Transform.rotate怎么用?Python Transform.rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.rotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: transformFunc
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import rotate [as 别名]
def transformFunc(self):
import Image as i, Transform
self.pic = i.Image("Resources/test.jpg")
if(self.radioButton.isChecked()):
self.pic.set_img(Transform.crop(self.pic.get_img(),self.spinBox_2.value(),self.spinBox_3.value()))
if(self.radioButton_9.isChecked()):
self.pic.set_img(Transform.rotate(self.pic.get_img(),self.spinBox.value()))
if(self.radioButton_10.isChecked()):
if(self.checkBox.isChecked()):
self.pic.set_img(Transform.flip(self.pic.get_img(),1))
if(self.checkBox_2.isChecked()):
self.pic.set_img(Transform.flip(self.pic.get_img(),2))
from scipy.misc import imsave
imsave("Resources/test2.jpg",self.pic.get_img())
self.imageUpdate("Resources/test2.jpg")
示例2: Context
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import rotate [as 别名]
class Context():
'''
The Box class is an abstraction to hold a Cairo surface, context and all
methods to access and manipulate it (the Nodebox language is
implemented here).
'''
inch = 72
cm = 28.3465
mm = 2.8346
RGB = "rgb"
HSB = "hsb"
CENTER = "center"
CORNER = "corner"
CORNERS = "corners"
DEFAULT_WIDTH = 200
DEFAULT_HEIGHT = 200
NORMAL = "1"
FORTYFIVE = "2"
#self.cairoContext = None
#self._ctx
def __init__(self):
self.cairoContext = None
self.RGB = "rgb"
self.HSB = "hsb"
self.CMYK = "cmyk"
self._colormode = self.RGB
self._fillState = 1
self._lineWidth = 1
self._autoclosepath = True
self._transform = Transform()
self._fontsize = 10
#self._color = Color()
def size(self, width, height):
self.width = width
self.height = height
def rect2(self, x, y, width, height, roundness=0.0, draw=True):
if roundness == 0:
p = BezierPath()
p.rect(x, y, width, height)
else:
curve = min(width*roundness, height*roundness)
p = self.BezierPath(**kwargs)
p.moveto(x, y+curve)
p.curveto(x, y, x, y, x+curve, y)
p.lineto(x+width-curve, y)
p.curveto(x+width, y, x+width, y, x+width, y+curve)
p.lineto(x+width, y+height-curve)
p.curveto(x+width, y+height, x+width, y+height, x+width-curve, y+height)
p.lineto(x+curve, y+height)
p.curveto(x, y+height, x, y+height, x, y+height-curve)
p.closepath()
def createGraphContext( self, wxPaintDCObject):
self.cairoContext = wx.lib.wxcairo.ContextFromDC(wxPaintDCObject)
return self.cairoContext
def getGraphContext( self):
return self.cairoContext
# version 0.00
def rect( self, x, y, width, height, roundness=0.0, draw=True):
'''Draws a rectangle with top left corner at (x,y)
The roundness variable sets rounded corners.
'''
# straight corners
if roundness == 0.0:
self.cairoContext.save ()
if self._transform.mode == CENTER:
self.cairoContext.translate( x + width/2., y + height/2.)
self.cairoContext.rotate( - self._transform.radians)
x0 = -width/2.
y0 = -height/2.
else:
x0 = x
y0 = y
self.cairoContext.rectangle( x0, y0, width, height)
self.cairoContext.set_line_width( self._lineWidth)
if self._fillState == 1:
self.cairoContext.fill()
self.cairoContext.restore ()
else:
self.cairoContext.save ()
if self._transform.mode == CENTER:
self.cairoContext.translate( x + width/2., y + height/2.)
self.cairoContext.rotate( - self._transform.radians)
x0 = -width/2.
y0 = -height/2.
else:
x0 = x
#.........这里部分代码省略.........