def EpsFile(self, data, trafo, relative_filename=1): write = self.file.write write('eps(') if trafo.matrix() != IdentityMatrix: write('(%g,%g,%g,%g,%g,%g)' % trafo.coeff()) else: write('(%g,%g)' % (trafo.v1, trafo.v2)) filename = data.Filename() if self.directory and relative_filename: filename = relpath(self.directory, filename) write(',%s)\n' % ` filename `)
def EpsFile(self, data, trafo, relative_filename = 1): write = self.file.write write('eps(') if trafo.matrix() != IdentityMatrix: write('(%g,%g,%g,%g,%g,%g)' % trafo.coeff()) else: write('(%g,%g)' % (trafo.v1, trafo.v2)) filename = data.Filename() if self.directory and relative_filename: filename = relpath(self.directory, filename) write(',%s)\n' % `filename`)
def write_image(self, image, relative_filename=1): write = self.file.write if not self.saved_ids.has_key(id(image)): imagefile = image.Filename() if not imagefile: from streamfilter import Base64Encode write('bm(%d)\n' % id(image)) file = Base64Encode(self.file) image.image.save(file, 'PNG') file.close() write('-\n') else: if self.directory and relative_filename: imagefile = relpath(self.directory, imagefile) write('bm(%d,%s)\n' % (id(image), ` imagefile `)) self.saved_ids[id(image)] = image
def write_image(self, image, relative_filename = 1): write = self.file.write if not self.saved_ids.has_key(id(image)): imagefile = image.Filename() if not imagefile: from streamfilter import Base64Encode write('bm(%d)\n' % id(image)) file = Base64Encode(self.file) image.image.save(file, 'PPM') file.close() write('-\n') else: if self.directory and relative_filename: imagefile = relpath(self.directory, imagefile) write('bm(%d,%s)\n' % (id(image), `imagefile`)) self.saved_ids[id(image)] = image