MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / draw_path

Method draw_path

lib/matplotlib/backends/backend_cairo.py:120–155  ·  view source on GitHub ↗
(self, gc, path, transform, rgbFace=None)

Source from the content-addressed store, hash-verified

118 ctx.stroke()
119
120 def draw_path(self, gc, path, transform, rgbFace=None):
121 # docstring inherited
122 ctx = gc.ctx
123 # Clip the path to the actual rendering extents if it isn't filled.
124 clip = (ctx.clip_extents()
125 if rgbFace is None and gc.get_hatch() is None
126 else None)
127 transform = (transform
128 + Affine2D().scale(1, -1).translate(0, self.height))
129 ctx.new_path()
130 _append_path(ctx, path, transform, clip)
131 if rgbFace is not None:
132 ctx.save()
133 _set_rgba(ctx, rgbFace, gc.get_alpha(), gc.get_forced_alpha())
134 ctx.fill_preserve()
135 ctx.restore()
136 hatch_path = gc.get_hatch_path()
137 if hatch_path:
138 dpi = int(self.dpi)
139 hatch_surface = ctx.get_target().create_similar(
140 cairo.Content.COLOR_ALPHA, dpi, dpi)
141 hatch_ctx = cairo.Context(hatch_surface)
142 _append_path(hatch_ctx, hatch_path,
143 Affine2D().scale(dpi, -dpi).translate(0, dpi),
144 None)
145 hatch_ctx.set_line_width(self.points_to_pixels(gc.get_hatch_linewidth()))
146 hatch_ctx.set_source_rgba(*gc.get_hatch_color())
147 hatch_ctx.fill_preserve()
148 hatch_ctx.stroke()
149 hatch_pattern = cairo.SurfacePattern(hatch_surface)
150 hatch_pattern.set_extend(cairo.Extend.REPEAT)
151 ctx.save()
152 ctx.set_source(hatch_pattern)
153 ctx.fill_preserve()
154 ctx.restore()
155 ctx.stroke()
156
157 def draw_markers(self, gc, marker_path, marker_trans, path, transform,
158 rgbFace=None):

Callers

nothing calls this directly

Calls 15

points_to_pixelsMethod · 0.95
Affine2DClass · 0.90
_append_pathFunction · 0.85
_set_rgbaFunction · 0.85
translateMethod · 0.80
saveMethod · 0.80
get_forced_alphaMethod · 0.80
get_hatch_pathMethod · 0.80
get_hatch_colorMethod · 0.80
strokeMethod · 0.80
get_hatchMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected