~ubuntu-branches/debian/sid/pyx/sid

« back to all changes in this revision

Viewing changes to pyx/mesh.py

  • Committer: Package Import Robot
  • Author(s): Stuart Prescott
  • Date: 2012-12-17 13:45:12 UTC
  • mfrom: (1.1.4)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: package-import@ubuntu.com-20121217134512-u0w6lrgdowsc1sfu
Tags: 0.12.1-1
* New upstream release
* Update maintainer address.
* Update copyright format URL.
* Bump standards version to 3.9.4 (no changes required).
* Drop postinst that was needed for lenny->squeeze upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
            import Image
114
114
            c = canvas.canvas()
115
115
            c.insert(self)
116
 
            fd, fname = tempfile.mkstemp()
117
 
            f = os.fdopen(fd, "wb")
118
 
            f.close()
119
 
            c.pipeGS(fname, device="pngalpha", resolution=writer.mesh_as_bitmap_resolution)
120
 
            i = Image.open(fname)
121
 
            os.unlink(fname)
 
116
            i = Image.open(c.pipeGS("pngalpha", resolution=writer.mesh_as_bitmap_resolution, seekable=True))
 
117
            i.load()
122
118
            b = bitmap.bitmap_pt(self.bbox().llx_pt, self.bbox().lly_pt, i)
123
119
            # we slightly shift the bitmap to re-center it, as the bitmap might contain some additional border
124
120
            # unfortunately we need to construct another bitmap instance for that ...
139
135
                  thisbbox.llx_pt, thisbbox.urx_pt, thisbbox.lly_pt, thisbbox.ury_pt,
140
136
                  " ".join(["0 1" for value in self.elements[0].nodes[0].value.to8bitstring()])))
141
137
            file.write(binascii.b2a_hex(zlib.compress(self.data(thisbbox))))
142
 
            file.write("\n")
 
138
            file.write(">\n")
143
139
 
144
140
    def processPDF(self, file, writer, context, registry, bbox):
145
141
        if writer.mesh_as_bitmap:
147
143
            import Image
148
144
            c = canvas.canvas()
149
145
            c.insert(self)
150
 
            fd, fname = tempfile.mkstemp()
151
 
            f = os.fdopen(fd, "wb")
152
 
            f.close()
153
 
            c.pipeGS(fname, device="pngalpha", resolution=writer.mesh_as_bitmap_resolution)
154
 
            i = Image.open(fname)
155
 
            os.unlink(fname)
 
146
            i = Image.open(c.pipeGS("pngalpha", resolution=writer.mesh_as_bitmap_resolution, seekable=True))
 
147
            i.load()
156
148
            b = bitmap.bitmap_pt(self.bbox().llx_pt, self.bbox().lly_pt, i)
157
149
            # we slightly shift the bitmap to re-center it, as the bitmap might contain some additional border
158
150
            # unfortunately we need to construct another bitmap instance for that ...