本文整理匯總了Python中cairo.LINE_CAP_SQUARE屬性的典型用法代碼示例。如果您正苦於以下問題:Python cairo.LINE_CAP_SQUARE屬性的具體用法?Python cairo.LINE_CAP_SQUARE怎麽用?Python cairo.LINE_CAP_SQUARE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類cairo
的用法示例。
在下文中一共展示了cairo.LINE_CAP_SQUARE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: drawCross
# 需要導入模塊: import cairo [as 別名]
# 或者: from cairo import LINE_CAP_SQUARE [as 別名]
def drawCross(self, context, redrawn):
xc_loc, yc_loc, square, side = self.square
context.move_to(xc_loc, yc_loc)
context.rel_line_to(square, square)
context.move_to(xc_loc + square, yc_loc)
context.rel_line_to(-square, square)
context.set_line_cap(cairo.LINE_CAP_SQUARE)
context.set_source_rgba(0, 0, 0, 0.65)
context.set_line_width(side)
context.stroke_preserve()
context.set_source_rgba(1, 0, 0, 0.8)
context.set_line_width(side / 2.)
context.stroke()
###############################
# drawSupportAlgorithm #
###############################
# Here is how we implemented representation of support algorithm :
# piece not protected -> yellow circle
# piece attacked and not protected -> red circle
# see SupportAlgorithm in file utils.DecisionSupportAlgorithm for more details on the algorithm
示例2: cairo_line_cap
# 需要導入模塊: import cairo [as 別名]
# 或者: from cairo import LINE_CAP_SQUARE [as 別名]
def cairo_line_cap(line_cap):
if line_cap == 'round':
return cairo.LINE_CAP_ROUND
elif line_cap == 'square':
return cairo.LINE_CAP_SQUARE
else:
return cairo.LINE_CAP_BUTT
示例3: draw_tree
# 需要導入模塊: import cairo [as 別名]
# 或者: from cairo import LINE_CAP_SQUARE [as 別名]
def draw_tree(head):
ctx.select_font_face(font_name)
ctx.set_font_size(base_font_size)
ctx.set_line_width(2)
ctx.set_line_cap(cairo.LINE_CAP_SQUARE)
ctx.set_line_join(cairo.LINE_JOIN_MITER)
set_line_style(ctx)
head.draw()
示例4: draw_zoom_target
# 需要導入模塊: import cairo [as 別名]
# 或者: from cairo import LINE_CAP_SQUARE [as 別名]
def draw_zoom_target(self, widget, cairo_context):
""" Perform the drawings by user.
Args:
widget (:class:`~Gtk.DrawingArea`): The widget where to draw the scribbles.
cairo_context (:class:`~cairo.Context`): The canvas on which to render the drawings
"""
ww, wh = widget.get_allocated_width(), widget.get_allocated_height()
if self.zoom_selecting and self.zoom_points:
xmin, xmax = sorted(p[0] * ww for p in self.zoom_points)
ymin, ymax = sorted(p[1] * wh for p in self.zoom_points)
rect = Gdk.Rectangle()
rect.x = xmin
rect.width = xmax - xmin
rect.y = ymin
rect.height = ymax - ymin
cairo_context.set_line_width(3)
cairo_context.set_line_cap(cairo.LINE_CAP_SQUARE)
Gdk.cairo_rectangle(cairo_context, rect)
cairo_context.set_source_rgba(.1, .1, 1, .4)
cairo_context.stroke()
Gdk.cairo_rectangle(cairo_context, rect)
cairo_context.set_source_rgba(.5, .5, 1, .2)
cairo_context.fill()