Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7535c26

Browse files
committed
Merge pull request matplotlib#4610 from jkseppan/pdf-hatch-comment
MNT: Replace outdated comment with self-explaining code (hatching in pdf backend)
2 parents 545c2a0 + 7f83ec2 commit 7535c26

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,14 +1176,12 @@ def writeHatches(self):
11761176
'XStep': sidelen, 'YStep': sidelen,
11771177
'Resources': res})
11781178

1179-
# lst is a tuple of stroke color, fill color,
1180-
# number of - lines, number of / lines,
1181-
# number of | lines, number of \ lines
1182-
rgb = hatch_style[0]
1183-
self.output(rgb[0], rgb[1], rgb[2], Op.setrgb_stroke)
1184-
if hatch_style[1] is not None:
1185-
rgb = hatch_style[1]
1186-
self.output(rgb[0], rgb[1], rgb[2], Op.setrgb_nonstroke,
1179+
stroke_rgb, fill_rgb, path = hatch_style
1180+
self.output(stroke_rgb[0], stroke_rgb[1], stroke_rgb[2],
1181+
Op.setrgb_stroke)
1182+
if fill_rgb is not None:
1183+
self.output(fill_rgb[0], fill_rgb[1], fill_rgb[2],
1184+
Op.setrgb_nonstroke,
11871185
0, 0, sidelen, sidelen, Op.rectangle,
11881186
Op.fill)
11891187

@@ -1192,7 +1190,7 @@ def writeHatches(self):
11921190
# TODO: We could make this dpi-dependent, but that would be
11931191
# an API change
11941192
self.output(*self.pathOperations(
1195-
Path.hatch(hatch_style[2]),
1193+
Path.hatch(path),
11961194
Affine2D().scale(sidelen),
11971195
simplify=False))
11981196
self.output(Op.stroke)

0 commit comments

Comments
 (0)