def mergeRotatedScaledPage(self, page2, rotation, scale, expand=False):
"""
This is similar to mergePage, but the stream to be merged is rotated
and scaled by appling a transformation matrix.
:param PageObject page2: the page to be merged into this one. Should be
an instance of :class:`PageObject<PageObject>`.
:param float rotation: The angle of the rotation, in degrees
:param float scale: The scaling factor
:param bool expand: Whether the page should be expanded to fit the
dimensions of the page to be merged.
"""
rotation = math.radians(rotation)
rotating = [[math.cos(rotation), math.sin(rotation), 0],
[-math.sin(rotation), math.cos(rotation), 0],
[0, 0, 1]]
scaling = [[scale, 0, 0],
[0, scale, 0],
[0, 0, 1]]
ctm = utils.matrixMultiply(rotating, scaling)
return self.mergeTransformedPage(page2,
[ctm[0][0], ctm[0][1],
ctm[1][0], ctm[1][1],
ctm[2][0], ctm[2][1]], expand)
评论列表
文章目录