[cairo] Re: drawlist type functionality?

dirk.schoenberger at sz-online.de dirk.schoenberger at sz-online.de
Mon Apr 4 23:58:28 PDT 2005


>>        # create a "bowtie" context
>>        ctx = cairo.Context()
>>        drawlist = cairo.Drawlist()
>>        ctx.set_target_drawlist(drawlist)
>>        ctx.move_to(0, 0)
>>        ctx.line_to(1, 1)
>>        ctx.line_to(1, 0)
>>        ctx.line_to(0, 1)
>>        ctx.close_path()
>
> Why don't you simply use a surface and then compose it
> onto the target drawable?
>

"surface" and "compose" sounds like you have already a pre-rendered
element, like a memory buffer.
The whole idea of a display list is to have the higher level operators in
order to be apbe to "replay" the commands in different contexts, without
rendering artifacts.

Something like

>>        drawlist = cairo.Drawlist()
>>        ctx.set_target_drawlist(drawlist)
>>        ctx.move_to(0, 0)
>>        ctx.line_to(1, 1)
>>        ctx.line_to(1, 0)
>>        ctx.line_to(0, 1)
>>        ctx.close_path()

ctx.gsave()
ctx.rotate(30)
ctx.draw(drawlist)
ctx.grestore

ctx.gsave()
ctx.rotate(45)
ctx.set_opacity(.9)
ctx.draw(drawlist)
ctx.grestore

Regards
Dirk




More information about the cairo mailing list