Пример #1
0
	def axial_gradient(self, properties, rect):
		pattern = properties.fill_pattern
		vx, vy = pattern.Direction()
		angle = atan2(vy, vx) - pi / 2
		center = rect.center()
		rot = Rotation(angle, center)
		left, bottom, right, top = rot(rect)
		trafo = rot(Translation(center))
		image = PIL.Image.new('RGB', (1, 200))
		border = int(round(100 * pattern.Border()))
		_sketch.fill_axial_gradient(image.im, pattern.Gradient().Colors(), 
									0, border, 0, 200 - border)
		self.pdf.saveState()
		apply(self.pdf.transform, trafo.coeff())
		self.pdf.drawInlineImage(image, (left - right) / 2, (bottom - top) / 2, 
								 right - left, top - bottom)
		self.pdf.restoreState()
 def axial_gradient(self, properties, rect):
     pattern = properties.fill_pattern
     vx, vy = pattern.Direction()
     angle = atan2(vy, vx) - pi / 2
     center = rect.center()
     rot = Rotation(angle, center)
     left, bottom, right, top = rot(rect)
     trafo = rot(Translation(center))
     image = PIL.Image.new('RGB', (1, 200))
     border = int(round(100 * pattern.Border()))
     _sketch.fill_axial_gradient(image.im,
                                 pattern.Gradient().Colors(), 0, border, 0,
                                 200 - border)
     self.pdf.saveState()
     apply(self.pdf.transform, trafo.coeff())
     self.pdf.drawInlineImage(image, (left - right) / 2, (bottom - top) / 2,
                              right - left, top - bottom)
     self.pdf.restoreState()