当前位置: 首页>>代码示例>>Python>>正文


Python cairo.LINE_CAP_SQUARE属性代码示例

本文整理汇总了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 
开发者ID:pychess,项目名称:pychess,代码行数:27,代码来源:BoardView.py

示例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 
开发者ID:kevinpt,项目名称:symbolator,代码行数:9,代码来源:cairo_backend.py

示例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() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:10,代码来源:ft.py

示例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() 
开发者ID:Cimbali,项目名称:pympress,代码行数:30,代码来源:extras.py


注:本文中的cairo.LINE_CAP_SQUARE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。