@@ -309,24 +309,17 @@ def pdfRepr(self):
309
309
for name , value in six .iteritems (_pdfops )]))
310
310
311
311
312
- def _paint_path (closep , fillp , strokep ):
312
+ def _paint_path (fill , stroke ):
313
313
"""Return the PDF operator to paint a path in the following way:
314
- closep: close the path before painting
315
- fillp: fill the path with the fill color
316
- strokep: stroke the outline of the path with the line color"""
317
- if strokep :
318
- if closep :
319
- if fillp :
320
- return Op .close_fill_stroke
321
- else :
322
- return Op .close_stroke
314
+ fill: fill the path with the fill color
315
+ stroke: stroke the outline of the path with the line color"""
316
+ if stroke :
317
+ if fill :
318
+ return Op .fill_stroke
323
319
else :
324
- if fillp :
325
- return Op .fill_stroke
326
- else :
327
- return Op .stroke
320
+ return Op .stroke
328
321
else :
329
- if fillp :
322
+ if fill :
330
323
return Op .fill
331
324
else :
332
325
return Op .endpath
@@ -1322,7 +1315,7 @@ def writeImages(self):
1322
1315
self .currentstream .write (data )
1323
1316
self .endStream ()
1324
1317
1325
- def markerObject (self , path , trans , fillp , strokep , lw , joinstyle ,
1318
+ def markerObject (self , path , trans , fill , stroke , lw , joinstyle ,
1326
1319
capstyle ):
1327
1320
"""Return name of a marker XObject representing the given path."""
1328
1321
# self.markers used by markerObject, writeMarkers, close:
@@ -1338,7 +1331,7 @@ def markerObject(self, path, trans, fillp, strokep, lw, joinstyle,
1338
1331
# first two components of each value in self.markers to be the
1339
1332
# name and object reference.
1340
1333
pathops = self .pathOperations (path , trans , simplify = False )
1341
- key = (tuple (pathops ), bool (fillp ), bool (strokep ), joinstyle , capstyle )
1334
+ key = (tuple (pathops ), bool (fill ), bool (stroke ), joinstyle , capstyle )
1342
1335
result = self .markers .get (key )
1343
1336
if result is None :
1344
1337
name = Name ('M%d' % len (self .markers ))
@@ -1352,7 +1345,7 @@ def markerObject(self, path, trans, fillp, strokep, lw, joinstyle,
1352
1345
return name
1353
1346
1354
1347
def writeMarkers (self ):
1355
- for ((pathops , fillp , strokep , joinstyle , capstyle ),
1348
+ for ((pathops , fill , stroke , joinstyle , capstyle ),
1356
1349
(name , ob , bbox , lw )) in six .iteritems (self .markers ):
1357
1350
bbox = bbox .padded (lw * 0.5 )
1358
1351
self .beginStream (
@@ -1363,7 +1356,7 @@ def writeMarkers(self):
1363
1356
Op .setlinejoin )
1364
1357
self .output (GraphicsContextPdf .capstyles [capstyle ], Op .setlinecap )
1365
1358
self .output (* pathops )
1366
- self .output (Op .paint_path (False , fillp , strokep ))
1359
+ self .output (Op .paint_path (fill , stroke ))
1367
1360
self .endStream ()
1368
1361
1369
1362
def pathCollectionObject (self , gc , path , trans , padding , filled , stroked ):
@@ -1392,7 +1385,7 @@ def writePathCollectionTemplates(self):
1392
1385
Op .setlinejoin )
1393
1386
self .output (GraphicsContextPdf .capstyles [capstyle ], Op .setlinecap )
1394
1387
self .output (* pathops )
1395
- self .output (Op .paint_path (False , filled , stroked ))
1388
+ self .output (Op .paint_path (filled , stroked ))
1396
1389
self .endStream ()
1397
1390
1398
1391
@staticmethod
@@ -1690,12 +1683,12 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans,
1690
1683
return
1691
1684
1692
1685
self .check_gc (gc , rgbFace )
1693
- fillp = gc .fillp (rgbFace )
1694
- strokep = gc .strokep ()
1686
+ fill = gc .fill (rgbFace )
1687
+ stroke = gc .stroke ()
1695
1688
1696
1689
output = self .file .output
1697
1690
marker = self .file .markerObject (
1698
- marker_path , marker_trans , fillp , strokep , self .gc ._linewidth ,
1691
+ marker_path , marker_trans , fill , stroke , self .gc ._linewidth ,
1699
1692
gc .get_joinstyle (), gc .get_capstyle ())
1700
1693
1701
1694
output (Op .gsave )
@@ -2136,7 +2129,7 @@ def __repr__(self):
2136
2129
del d ['parent' ]
2137
2130
return repr (d )
2138
2131
2139
- def strokep (self ):
2132
+ def stroke (self ):
2140
2133
"""
2141
2134
Predicate: does the path need to be stroked (its outline drawn)?
2142
2135
This tests for the various conditions that disable stroking
@@ -2147,7 +2140,7 @@ def strokep(self):
2147
2140
return (self ._linewidth > 0 and self ._alpha > 0 and
2148
2141
(len (self ._rgb ) <= 3 or self ._rgb [3 ] != 0.0 ))
2149
2142
2150
- def fillp (self , * args ):
2143
+ def fill (self , * args ):
2151
2144
"""
2152
2145
Predicate: does the path need to be filled?
2153
2146
@@ -2162,19 +2155,12 @@ def fillp(self, *args):
2162
2155
(_fillcolor is not None and
2163
2156
(len (_fillcolor ) <= 3 or _fillcolor [3 ] != 0.0 )))
2164
2157
2165
- def close_and_paint (self ):
2166
- """
2167
- Return the appropriate pdf operator to close the path and
2168
- cause it to be stroked, filled, or both.
2169
- """
2170
- return Op .paint_path (True , self .fillp (), self .strokep ())
2171
-
2172
2158
def paint (self ):
2173
2159
"""
2174
2160
Return the appropriate pdf operator to cause the path to be
2175
2161
stroked, filled, or both.
2176
2162
"""
2177
- return Op .paint_path (False , self .fillp (), self .strokep ())
2163
+ return Op .paint_path (self .fill (), self .stroke ())
2178
2164
2179
2165
capstyles = {'butt' : 0 , 'round' : 1 , 'projecting' : 2 }
2180
2166
joinstyles = {'miter' : 0 , 'round' : 1 , 'bevel' : 2 }
0 commit comments