def render_thumbnail(self): t0 = time.time() x, y, w, h = self.get_effective_bbox() mipmap_level = 0 while mipmap_level < tiledsurface.MAX_MIPMAP_LEVEL and max(w, h) >= 512: mipmap_level += 1 x, y, w, h = x/2, y/2, w/2, h/2 pixbuf = self.render_as_pixbuf(x, y, w, h, mipmap_level=mipmap_level) assert pixbuf.get_width() == w and pixbuf.get_height() == h pixbuf = helpers.scale_proportionally(pixbuf, 256, 256) print 'Rendered thumbnail in', time.time() - t0, 'seconds.' return pixbuf
def render_thumbnail(self): t0 = time.time() x, y, w, h = self.get_effective_bbox() if w == 0 or h == 0: # workaround to save empty documents x, y, w, h = 0, 0, tiledsurface.N, tiledsurface.N mipmap_level = 0 while mipmap_level < tiledsurface.MAX_MIPMAP_LEVEL and max(w, h) >= 512: mipmap_level += 1 x, y, w, h = x/2, y/2, w/2, h/2 pixbuf = self.render_as_pixbuf(x, y, w, h, mipmap_level=mipmap_level) assert pixbuf.get_width() == w and pixbuf.get_height() == h pixbuf = helpers.scale_proportionally(pixbuf, 256, 256) print 'Rendered thumbnail in', time.time() - t0, 'seconds.' return pixbuf
def render_thumbnail(self): t0 = time.time() x, y, w, h = self.get_effective_bbox() if w == 0 or h == 0: # workaround to save empty documents x, y, w, h = 0, 0, tiledsurface.N, tiledsurface.N mipmap_level = 0 while mipmap_level < tiledsurface.MAX_MIPMAP_LEVEL and max(w, h) >= 512: mipmap_level += 1 x, y, w, h = x/2, y/2, w/2, h/2 pixbuf = self.render_as_pixbuf(x, y, w, h, mipmap_level=mipmap_level) assert pixbuf.get_width() == w and pixbuf.get_height() == h pixbuf = helpers.scale_proportionally(pixbuf, 256, 256) logger.info('Rendered thumbnail in %d seconds.', time.time() - t0) return pixbuf