MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / writeHatches

Method writeHatches

site-packages/matplotlib/backends/backend_pdf.py:1216–1252  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1214 return name
1215
1216 def writeHatches(self):
1217 hatchDict = dict()
1218 sidelen = 72.0
1219 for hatch_style, name in self.hatchPatterns.items():
1220 ob = self.reserveObject('hatch pattern')
1221 hatchDict[name] = ob
1222 res = {'Procsets':
1223 [Name(x) for x in "PDF Text ImageB ImageC ImageI".split()]}
1224 self.beginStream(
1225 ob.id, None,
1226 {'Type': Name('Pattern'),
1227 'PatternType': 1, 'PaintType': 1, 'TilingType': 1,
1228 'BBox': [0, 0, sidelen, sidelen],
1229 'XStep': sidelen, 'YStep': sidelen,
1230 'Resources': res,
1231 # Change origin to match Agg at top-left.
1232 'Matrix': [1, 0, 0, 1, 0, self.height * 72]})
1233
1234 stroke_rgb, fill_rgb, path = hatch_style
1235 self.output(stroke_rgb[0], stroke_rgb[1], stroke_rgb[2],
1236 Op.setrgb_stroke)
1237 if fill_rgb is not None:
1238 self.output(fill_rgb[0], fill_rgb[1], fill_rgb[2],
1239 Op.setrgb_nonstroke,
1240 0, 0, sidelen, sidelen, Op.rectangle,
1241 Op.fill)
1242
1243 self.output(rcParams['hatch.linewidth'], Op.setlinewidth)
1244
1245 self.output(*self.pathOperations(
1246 Path.hatch(path),
1247 Affine2D().scale(sidelen),
1248 simplify=False))
1249 self.output(Op.fill_stroke)
1250
1251 self.endStream()
1252 self.writeObject(self.hatchObject, hatchDict)
1253
1254 def addGouraudTriangles(self, points, colors):
1255 name = Name('GT%d' % len(self.gouraudTriangles))

Callers 1

finalizeMethod · 0.95

Calls 12

reserveObjectMethod · 0.95
beginStreamMethod · 0.95
outputMethod · 0.95
pathOperationsMethod · 0.95
endStreamMethod · 0.95
writeObjectMethod · 0.95
Affine2DClass · 0.90
hatchMethod · 0.80
NameClass · 0.70
itemsMethod · 0.45
splitMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected