Python cairo.LINE_CAP_SQUARE Examples
The following are 5
code examples of cairo.LINE_CAP_SQUARE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cairo
, or try the search function
.
Example #1
Source File: BoardView.py From pychess with GNU General Public License v3.0 | 6 votes |
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
Example #2
Source File: cairo_backend.py From symbolator with MIT License | 5 votes |
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
Example #3
Source File: ft.py From addons-source with GNU General Public License v2.0 | 5 votes |
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()
Example #4
Source File: DescendantsLines.py From addons-source with GNU General Public License v2.0 | 5 votes |
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()
Example #5
Source File: extras.py From pympress with GNU General Public License v2.0 | 5 votes |
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()