[cairo] How to represent a hollow path? cairo_wrapper on php

Travis Griggs tgriggs at cincom.com
Fri Jul 24 00:03:30 PDT 2009


On Jul 23, 2009, at 11:19 PM, Fan Zhang wrote:

> Dear All,
>
> I'm using cairo with php to draw PNG, I've tried with layers and masks
> to represent hollow path however the PNG generated differently.
>
> For example, if to draw a shape of charactor 'O', I draw the outside
> path and fill it black, then the inside path. The inside path should  
> be
> transparent since the surface color is also transparent.
> If to fill the inside layer with alpha 0, the path just won't show.  
> How
> should I do it?

Two (at least off top of head) choices:

1) Stroke it instead. I assume the O is just a lucky case where you  
could stroke and get the O shape. So I'm betting this doesn't actually  
work for you?

2) Make your path have two circles, an inner and an outer, but make  
the inner go backwards from the outer one by using  
cairo_arc_negative()  and then fill. This will fill between the two  
arcs described.

--
Travis Griggs
Objologist
"Dying men never wish they'd spent more time at the office"




More information about the cairo mailing list