[cairo] Fill not overlapping stroke?

Stuart Axon stuaxo2 at yahoo.com
Tue Jun 1 17:25:09 PDT 2010

  My question was basically asked here:


...the problem at hand is this: If I want to draw an object with a 
fill and fat stroke, I can set up the path, then fill_preserve it, then 
stroke it. That works fine for opaque objects, but if I do that with an 
alpha channel, the stroke gets alpha blended into the fill, so that half 
the line looks like I want, but the other half is a half-color. This 
isn't too bad with a thin stroke but if the stroke is pretty fat, it 
really doesn't look right.

I've enclosed a PNG of an example. The same rectangle rendered on a 
white background, one with alpha = 1.0, and one with alpha = 0.5

Is there any solution to this?

Example: http://lists.freedesktop.org/archives/cairo/attachments/20060428/5d44cab1/junk7.png

I know an example was posted recently which works if you want both stroke and fill to the
same alpha, but this doesn't work if stroke and fill can arbitrary alphas.

I suppose what I want is a way to just fill inside the stroke and not overlap it;
or a way to pass fill and stroke at the same time.



More information about the cairo mailing list