[cairo] Blitting and sprites in Cairo

Donn donn.ingle at gmail.com
Wed May 15 01:47:31 PDT 2013


How would you move a sprite across a background?

The sprite could be:

draw rectangle 32x32
clip()
push_group()
draw sprite with cairo functions
s=pop_group()

But now:

Draw background once
loop start
  Copy rect of bg where sprite is gonna go //How do you do this?
   translate() //move sprite
   set_source(s)
   paint() //Draw the sprite
  //Replace the backdrop
  ?? //Some kind of set_source + paint again?
loop

That kind of jazz.

Is this the right approach in Cairo? Is there a better way, or a faster 
one?

(I'm kinda pining for the old days of vram and rows of bytes! :D)

\d


More information about the cairo mailing list