[cairo] Cairo is non-deterministic?

Lawrence Oluyede l.oluyede at gmail.com
Mon Jan 2 01:37:24 PST 2006


I'm using Cairo (with pycairo) for a test project and meanwhile I'm
gonna learn to use it but I'm "worried" about somethings that I can't
handle. Why this works:

    def draw_rows(self):
        self.context.save()
        # move down to the border position
        self.context.move_to(*self.border_pos)
        self.context.rel_move_to(200, 30)

        # draw one segment up
        self.context.save()
        self.context.rel_line_to(0, -100)
        self.context.stroke()
        self.context.close_path()
        self.context.restore()

        # draw an horizontal line (unit = 10 pixels)
        self.context.save()
        unit = 10
        for i in range(4):
            self.context.rel_line_to(unit, 0)
        self.context.stroke_preserve()
        self.context.close_path()
        self.context.restore()


        self.context.restore()

and the same with "draw one segment up" block written after the "draw
an horizontal line" doesn't?

Is there something I'm missing?

--
Lawrence
http://www.oluyede.org/blog


More information about the cairo mailing list