def draw1(self, ctx, scale): self.start_clipping(ctx, scale) ctx.scale(scale, scale) for id, line, properties, style in reversed(self.lines): #draw_line_string(ctx, self.scale_points(line, scale)) draw_line_string(ctx, line) stroke_with_style(ctx, style)
def draw1(self, ctx, scale): self.start_clipping(ctx, scale) for id, polygon, properties, style in self.polygons: draw_polygon(ctx, self.scale_points(polygon, scale)) fill_with_style(ctx, style, preserve=True) stroke_with_style(ctx, style, preserve=True) ctx.new_path() for id, line, properties, style in self.lines: draw_line_string(ctx, self.scale_points(line, scale)) stroke_with_style(ctx, style) for id, point, properties, style in self.points: draw_node_dots(ctx, [point], style=style)
def draw2(self, ctx, scale): self.start_clipping(ctx, scale) ctx.scale(scale, scale) for id, line, name, style in self.lines: if 'overline-width' in style: #draw_line_string(ctx, self.scale_points(line, scale)) draw_line_string(ctx, line) ctx.set_line_width(style.get('overline-width')) ctx.set_source_rgba(*style.get('overline-color')) ctx.set_dash(style.get('overline-dasharray', ())) ctx.set_line_join(self.line_join[style.get('overline-join', 'miter')]) ctx.set_line_cap(self.line_cap[style.get('overline-cap', 'butt')]) ctx.stroke()