本文整理匯總了Python中reportlab.graphics.shapes.ArcPath.strokeWidth方法的典型用法代碼示例。如果您正苦於以下問題:Python ArcPath.strokeWidth方法的具體用法?Python ArcPath.strokeWidth怎麽用?Python ArcPath.strokeWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類reportlab.graphics.shapes.ArcPath
的用法示例。
在下文中一共展示了ArcPath.strokeWidth方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from reportlab.graphics.shapes import ArcPath [as 別名]
# 或者: from reportlab.graphics.shapes.ArcPath import strokeWidth [as 別名]
#.........這裏部分代碼省略.........
# Background image.
if self.specs.background_image:
self._bgimage = deepcopy(self.specs.background_image)
# Different classes are scaled in different ways...
if isinstance(self._bgimage, Image):
self._bgimage.x = 0
self._bgimage.y = 0
self._bgimage.width = self._pagesize[0]
self._bgimage.height = self._pagesize[1]
elif isinstance(self._bgimage, Drawing):
self._bgimage.shift(0, 0)
self._bgimage.scale(self._pagesize[0] / self._bgimage.width, self._pagesize[1] / self._bgimage.height)
else:
raise ValueError("Unhandled background type.")
# Background from a filename.
elif self.specs.background_filename:
self._bgimage = Image(0, 0, self._pagesize[0], self._pagesize[1], self.specs.background_filename)
# No background.
else:
self._bgimage = None
# Borders and clipping paths. We need two clipping paths; one for the
# label as a whole (which is identical to the border), and one for the
# available drawing area (i.e., after taking the padding into account).
# This is necessary because sometimes the drawing area can extend
# outside the border at the corners, e.g., if there is left padding
# only and no padding radius, then the 'available' area corners will be
# square and go outside the label corners if they are rounded.
# Copy some properties to a local scope.
h, w, r = float(self._lh), float(self._lw), float(self._cr)
# Create the border from a path. If the corners are not rounded, skip
# adding the arcs.
border = ArcPath()
if r:
border.moveTo(w - r, 0)
border.addArc(w - r, r, r, -90, 0)
border.lineTo(w, h - r)
border.addArc(w - r, h - r, r, 0, 90)
border.lineTo(r, h)
border.addArc(r, h - r, r, 90, 180)
border.lineTo(0, r)
border.addArc(r, r, r, 180, 270)
border.closePath()
else:
border.moveTo(0, 0)
border.lineTo(w, 0)
border.lineTo(w, h)
border.lineTo(0, h)
border.closePath()
# Set the properties and store.
border.isClipPath = 0
border.strokeWidth = 1
border.strokeColor = colors.black
border.fillColor = None
self._border = border
# Clip path for the label is the same as the border.
self._clip_label = deepcopy(border)
self._clip_label.isClipPath = 1
self._clip_label.strokeColor = None
self._clip_label.fillColor = None
# If there is no padding (i.e., the drawable area is the same as the
# label area) then we can just use the label clip path for the drawing
# clip path.
if (self._dw == self._lw) and (self._dh == self._lh):
self._clip_drawing = self._clip_label
# Otherwise we have to generate a separate path.
else:
h, w, r = float(self._dh), float(self._dw), float(self._pr)
clip = ArcPath()
if r:
clip.moveTo(w - r, 0)
clip.addArc(w - r, r, r, -90, 0)
clip.lineTo(w, h - r)
clip.addArc(w - r, h - r, r, 0, 90)
clip.lineTo(r, h)
clip.addArc(r, h - r, r, 90, 180)
clip.lineTo(0, r)
clip.addArc(r, r, r, 180, 270)
clip.closePath()
else:
clip.moveTo(0, 0)
clip.lineTo(w, 0)
clip.lineTo(w, h)
clip.lineTo(0, h)
clip.closePath()
# Set the clipping properties.
clip.isClipPath = 1
clip.strokeColor = None
clip.fillColor = None
self._clip_drawing = clip