Python cairo 模块,LINE_JOIN_MITER 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用cairo.LINE_JOIN_MITER

项目:autoinjection    作者:ChengWiLL    | 项目源码 | 文件源码
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))
项目:bokken    作者:thestr4ng3r    | 项目源码 | 文件源码
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))
项目:Eagle    作者:magerx    | 项目源码 | 文件源码
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))
项目:landport    作者:land-pack    | 项目源码 | 文件源码
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))
项目:Helix    作者:3lackrush    | 项目源码 | 文件源码
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))
项目:autoscan    作者:b01u    | 项目源码 | 文件源码
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))
项目:neferset    作者:andburn    | 项目源码 | 文件源码
def text_path(context, font, size, text, debug=False):
    """Create a Pango text layout and return it as a Cairo path"""

    context.save()

    pg_layout = PangoCairo.create_layout(context)
    pg_context = pg_layout.get_context()

    font_options = cairo.FontOptions()
    font_options.set_antialias(cairo.ANTIALIAS_SUBPIXEL)
    PangoCairo.context_set_font_options(pg_context, font_options)
    font_descp = "{0} {1:d}".format(font, size)
    pg_layout.set_font_description(Pango.FontDescription(font_descp))
    pg_layout.set_text(text, -1) # force length calculation

    PangoCairo.update_layout(context, pg_layout)
    # TODO watch out for ink & logical, need check
    extents = pg_layout.get_pixel_extents()[0]
    # TODO debug necessary?
    if debug:
        context.set_source_rgb(0, 0, 0)
        PangoCairo.show_layout(context, pg_layout)
        print("text_path: ({0}, {1}, {2}, {3})".format(
            extents.x, extents.y, extents.width, extents.height))
        context.rectangle(extents.x, extents.y, extents.width, extents.height)
        context.set_line_width(1.0)
        context.set_line_join(cairo.LINE_JOIN_MITER)
        context.set_source_rgb(0, 0.8, 0)
        context.stroke()

    #PangoCairo.layout_path(context, pg_layout)
    PangoCairo.layout_line_path(context, pg_layout.get_line(0))
    path = context.copy_path()
    # clear the path
    context.new_path()
    context.restore()
    return (path, extents, xheight(pg_layout).height)