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

Method writeHatches

lib/matplotlib/backends/backend_pdf.py:1480–1518  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1478 }))
1479
1480 def writeHatches(self):
1481 hatchDict = dict()
1482 sidelen = 72.0
1483 for hatch_style, name in self._hatch_patterns.items():
1484 ob = self.reserveObject('hatch pattern')
1485 hatchDict[name] = ob
1486 res = {'Procsets':
1487 [Name(x) for x in "PDF Text ImageB ImageC ImageI".split()]}
1488 self.beginStream(
1489 ob.id, None,
1490 {'Type': Name('Pattern'),
1491 'PatternType': 1, 'PaintType': 1, 'TilingType': 1,
1492 'BBox': [0, 0, sidelen, sidelen],
1493 'XStep': sidelen, 'YStep': sidelen,
1494 'Resources': res,
1495 # Change origin to match Agg at top-left.
1496 'Matrix': [1, 0, 0, 1, 0, self.height * 72]})
1497
1498 stroke_rgb, fill_rgb, hatch, lw = hatch_style
1499 self.output(stroke_rgb[0], stroke_rgb[1], stroke_rgb[2],
1500 Op.setrgb_stroke)
1501 if fill_rgb is not None:
1502 self.output(fill_rgb[0], fill_rgb[1], fill_rgb[2],
1503 Op.setrgb_nonstroke,
1504 0, 0, sidelen, sidelen, Op.rectangle,
1505 Op.fill)
1506 self.output(stroke_rgb[0], stroke_rgb[1], stroke_rgb[2],
1507 Op.setrgb_nonstroke)
1508
1509 self.output(lw, Op.setlinewidth)
1510
1511 self.output(*self.pathOperations(
1512 Path.hatch(hatch),
1513 Affine2D().scale(sidelen),
1514 simplify=False))
1515 self.output(Op.fill_stroke)
1516
1517 self.endStream()
1518 self.writeObject(self.hatchObject, hatchDict)
1519
1520 def addGouraudTriangles(self, points, colors):
1521 """

Callers 1

finalizeMethod · 0.95

Calls 10

reserveObjectMethod · 0.95
beginStreamMethod · 0.95
outputMethod · 0.95
pathOperationsMethod · 0.95
endStreamMethod · 0.95
writeObjectMethod · 0.95
Affine2DClass · 0.90
NameClass · 0.85
hatchMethod · 0.80
scaleMethod · 0.45

Tested by

no test coverage detected