當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。