[cairo] New ruby cairo binding landed in CVS

Ned Konz ned at squeakland.org
Tue Feb 8 16:41:22 PST 2005


On Tuesday 08 February 2005 3:12 pm, mental at rydia.net wrote:
> I'm not sure I understand the utility of stroked_path and
> closed_path, nor of passing parameters to the block (blocks are
> closures after all, you can use local variables tranparently)...

Because I don't necessarily want to use inline blocks.

Consider this. At a global scope, I have:

$textBlock = Proc.new { |cr,font,scale,x,y,text|
      cr.select_font(font, Cairo::FONT_WEIGHT_NORMAL, 
Cairo::FONT_SLANT_NORMAL)
      cr.scale_font(scale)
      cr.move_to(x, y).text_path(text)
}


later...

    cr.closed_path(cr, 'Sans', 140, 50, 230, 'rcairo', &$textBlock)


-- 
Ned Konz
MetaMagix
Stanwood WA
(360) 629-1091



More information about the cairo mailing list