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

Method create_hatch

lib/matplotlib/backends/backend_ps.py:508–538  ·  view source on GitHub ↗
(self, hatch, linewidth)

Source from the content-addressed store, hash-verified

506 self.fontsize = fontsize
507
508 def create_hatch(self, hatch, linewidth):
509 sidelen = 72
510 if hatch in self._hatches:
511 return self._hatches[hatch]
512 name = 'H%d' % len(self._hatches)
513 pageheight = self.height * 72
514 self._pswriter.write(f"""\
515 << /PatternType 1
516 /PaintType 2
517 /TilingType 2
518 /BBox[0 0 {sidelen:d} {sidelen:d}]
519 /XStep {sidelen:d}
520 /YStep {sidelen:d}
521
522 /PaintProc {{
523 pop
524 {linewidth:g} setlinewidth
525{self._convert_path(Path.hatch(hatch), Affine2D().scale(sidelen), simplify=False)}
526 gsave
527 fill
528 grestore
529 stroke
530 }} bind
531 >>
532 matrix
533 0 {pageheight:g} translate
534 makepattern
535 /{name} exch def
536""")
537 self._hatches[hatch] = name
538 return name
539
540 def get_image_magnification(self):
541 """

Callers 1

_draw_psMethod · 0.95

Calls 5

_convert_pathMethod · 0.95
Affine2DClass · 0.90
hatchMethod · 0.80
writeMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected