本文整理汇总了Python中cairo.Context.transform方法的典型用法代码示例。如果您正苦于以下问题:Python Context.transform方法的具体用法?Python Context.transform怎么用?Python Context.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo.Context
的用法示例。
在下文中一共展示了Context.transform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_draw
# 需要导入模块: from cairo import Context [as 别名]
# 或者: from cairo.Context import transform [as 别名]
def on_draw(self, widget: Widget, context: cairo.Context):
for child in self.list:
if child.visible:
context.save()
context.transform(child.fromWidgetCoords)
if child.is_clip_set():
rectangle = child.clip_rectangle
context.rectangle(rectangle.start.x,rectangle.start.y,
rectangle.width,rectangle.height)
context.clip()
child.on_draw(self,context)
context.restore()
示例2: ImageSurface
# 需要导入模块: from cairo import Context [as 别名]
# 或者: from cairo.Context import transform [as 别名]
face.set_char_size( 48*64 )
face.load_char('S')
slot = face.glyph
outline = slot.outline
points = numpy.array(outline.points, dtype=[('x',float), ('y',float)])
x, y = points['x'], points['y']
cbox = outline.get_cbox()
surface = ImageSurface(FORMAT_ARGB32,
(cbox.xMax - cbox.xMin)//4 + 20,
(cbox.yMax - cbox.yMin)//4 + 20)
ctx = Context(surface)
ctx.scale(0.25,0.25)
ctx.translate(-cbox.xMin + 40,-cbox.yMin + 40)
ctx.transform(Matrix(1,0,0,-1))
ctx.translate(0, -(cbox.yMax + cbox.yMin)) # difference!
Curve_Tag = [FT_Curve_Tag(tag) for tag in outline.tags]
start, end = 0, 0
VERTS, CODES = [], []
# Iterate over each contour
ctx.set_source_rgb(0.5,0.5,0.5)
for i in range(len(outline.contours)):
end = outline.contours[i]
ctx.move_to(outline.points[start][0],outline.points[start][1])
for j in range(start, end+1):
point = outline.points[j]