On Sat, Nov 5, 2011 at 8:56 AM, Walter Bender <walter.ben...@gmail.com> wrote: > I pushed a few more patches last night [1]. I have just two blockers > right now to releasing the Cairo version: > > (1) I cannot seem to figure out how to convert my surface to a pixbuf > or png for saving to a file; > surface = canvas.canvas.get_target() # get the surface used > by the canvas > surface.cairo_surface_write_to_png(file_name) <--- fails > because XlibSurface doesn't have a cairo_surface_write_to_png > attribute > (2) I cannot seem to create the proper surface from a Pixbuf to use in > non-interactive mode in replacement of the canvas surface. I have > unsuccessfully tried to create a pixbuf and use it to source a cairo > context. > > The only non-blockers are: > (1) I am struggling with the erratic behavior of rotate on bitmaps. It > is disabled at the moment.
I was just thinking about it backwards... Works as expected now. > (2) There must be some way to cache the surfaces used by the sprites > instead of re-rendering them from pixbufs each time, but using > get_target() gives X errors. I'll keep poking at this one as I think it may help with performance. The basic idea is: for i, img in enumerate(self.images): if self.surfaces[i] is not None: cr.set_source_surface(self.surfaces[i], self.rect.x + self._dx[i], self.rect.y + self._dy[i]) else: cr.set_source_pixbuf(img, self.rect.x + self._dx[i], self.rect.y + self._dy[i]) self.surfaces[i] = cr.get_target() -walter > > Any pointers appreciated. > > -walter > > [1] http://git.sugarlabs.org/~walter/turtleart/walters-cairo/commits/master > > -- > Walter Bender > Sugar Labs > http://www.sugarlabs.org > -- Walter Bender Sugar Labs http://www.sugarlabs.org _______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel