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

Method _get_clip_attrs

lib/matplotlib/backends/backend_svg.py:618–639  ·  view source on GitHub ↗
(self, gc)

Source from the content-addressed store, hash-verified

616 return _generate_css(self._get_style_dict(gc, rgbFace))
617
618 def _get_clip_attrs(self, gc):
619 cliprect = gc.get_clip_rectangle()
620 clippath, clippath_trans = gc.get_clip_path()
621 if clippath is not None:
622 clippath_trans = self._make_flip_transform(clippath_trans)
623 dictkey = (self._get_clippath_id(clippath), str(clippath_trans))
624 elif cliprect is not None:
625 x, y, w, h = cliprect.bounds
626 y = self.height-(y+h)
627 dictkey = (x, y, w, h)
628 else:
629 return {}
630 clip = self._clipd.get(dictkey)
631 if clip is None:
632 oid = self._make_id('p', dictkey)
633 if clippath is not None:
634 self._clipd[dictkey] = ((clippath, clippath_trans), oid)
635 else:
636 self._clipd[dictkey] = (dictkey, oid)
637 else:
638 _, oid = clip
639 return {'clip-path': f'url(#{oid})'}
640
641 def _write_clips(self):
642 if not len(self._clipd):

Callers 6

draw_pathMethod · 0.95
draw_markersMethod · 0.95
draw_path_collectionMethod · 0.95
draw_imageMethod · 0.95
draw_textMethod · 0.95

Calls 6

_make_flip_transformMethod · 0.95
_get_clippath_idMethod · 0.95
_make_idMethod · 0.95
get_clip_rectangleMethod · 0.80
get_clip_pathMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected