[cairo] Fill not overlapping stroke?

Lutz Gehlen lrg_ml at gmx.net
Tue Jun 1 17:38:27 PDT 2010


Hello,

On Tue, Jun 01, 2010 at 05:25:09PM -0700, Stuart Axon wrote:

[...]

> 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.

I had the same problem and I solved it in the following way:
Paint on an intermediate surface
- 1. the fill with fill_preserve and with the desired alpha
- 2. the stroke with stroke_preserve and with the clear operator
  (this removes the fill in those regions where the stroke is going
  to be)
- 3. the stroke with the desired alpha

Hope that helps,
Lutz


More information about the cairo mailing list