|
From: <jo...@us...> - 2007-08-24 18:17:56
|
Revision: 3736
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3736&view=rev
Author: jouni
Date: 2007-08-24 11:17:51 -0700 (Fri, 24 Aug 2007)
Log Message:
-----------
Support get_image_magnification in pdf backend
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-08-23 18:02:03 UTC (rev 3735)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-08-24 18:17:51 UTC (rev 3736)
@@ -1021,7 +1021,7 @@
class RendererPdf(RendererBase):
- def __init__(self, file):
+ def __init__(self, file, dpi):
RendererBase.__init__(self)
self.file = file
self.gc = self.new_gc()
@@ -1033,6 +1033,7 @@
else:
self.encode_string = self.encode_string_type42
self.mathtext_parser = MathTextParser("Pdf")
+ self.image_magnification = dpi/72.0
def finalize(self):
self.gc.finalize()
@@ -1120,6 +1121,9 @@
self.file.output(self.gc.close_and_paint())
+ def get_image_magnification(self):
+ return self.image_magnification
+
def draw_image(self, x, y, im, bbox):
#print >>sys.stderr, "draw_image called"
@@ -1128,6 +1132,7 @@
self.check_gc(gc)
h, w = im.get_size_out()
+ h, w = h/self.image_magnification, w/self.image_magnification
imob = self.file.imageObject(im)
self.file.output(Op.gsave, w, 0, 0, h, x, y, Op.concat_matrix,
imob, Op.use_xobject, Op.grestore)
@@ -1735,7 +1740,7 @@
filename += '.pdf'
file = PdfFile(width, height, filename)
- renderer = RendererPdf(file)
+ renderer = RendererPdf(file, dpi)
self.figure.draw(renderer)
renderer.finalize()
file.close()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|