[cairo] Zooming a surface

rhn camali.rhn at porcupinefactory.org
Sun Jun 21 05:46:47 PDT 2009


Hi
While playing with Cairo using Python, I tried into a problem with drawing
surfaces.
The program I wrote is a cellular automata simulation - watching the pixels
move is not an option, so I've decided to zoom what's being drawn
(self.area.surface) and draw it again somewhere else (self.context):

        context = self.context
        context.rectangle(*self.rectangle)
        context.set_source_surface(self.area.surface)
        context.fill()
        self.redraw()

This code works almost as expected - it zooms the image in and displays it.
I couldn't find the way to disable antialiasing, though. I tried drawing a
simple rectangle right after the fill - surprisingly, it was sharp.
To exclude any faults in the source surface, I saved it to png - it was not
blurred.

I'd appreciate any help!


More information about the cairo mailing list