[cairo] rcairo save syntax (was Re: [rcairo] a problem in placing surface with "set_source")

Travis Griggs tgriggs at cincom.com
Sat Dec 29 10:55:08 PST 2007


On Dec 29, 2007, at 3:22 AM, Behdad Esfahbod wrote:

> On Sat, 2007-12-29 at 06:16 -0500, Binzo wrote:
>>
>> # invalid placing
>> cr.save {
>>  cr.set_source(img, 10.5, 30.5)
>>  cr.paint
>> }
>
> Humm, interesting syntax for save/restore.  Does rcairo still support
> the classic separate save() and restore() calls?


Smalltalk binding does the same thing. It's very handy. It's just a  
helper though, both Ruby and Smalltalk have the save/restore functions  
exposed for direct use. The Smalltalk one calls it "saveWhile:".

cr saveWhile: [
   cr source: image.
   cr paint.
]

Which is basically implemented as:

   cr save.
   aBlockClosure evaluate.
   cr restore.

The ruby implementation will be almost the same.

--
Travis Griggs
Objologist
"I choose. Therefore, I Am"




More information about the cairo mailing list