我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用cairo.LINE_CAP_BUTT。
def draw(self, cr, highlight_items=None): if highlight_items is None: highlight_items = () cr.set_source_rgba(0.0, 0.0, 0.0, 1.0) cr.set_line_cap(cairo.LINE_CAP_BUTT) cr.set_line_join(cairo.LINE_JOIN_MITER) for shape in self.shapes: shape.draw(cr) for edge in self.edges: edge.draw(cr, highlight=(edge in highlight_items)) for node in self.nodes: node.draw(cr, highlight=(node in highlight_items))
def crosshair(ctx, x, y, length, color=None): if not color: color = (1, 0, 0) ctx.save() ctx.set_source_rgb(*color) ctx.set_line_width(2.0) ctx.set_line_cap(cairo.LINE_CAP_BUTT) ctx.new_path() ctx.move_to(x, y + length) ctx.line_to(x, y - length) ctx.move_to(x + length, y) ctx.line_to(x - length, y) ctx.stroke() ctx.restore()