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()
评论列表
文章目录