[cairo] Problem clearing edge of a clip region

Jonathan Morton jonathan.morton at movial.com
Wed Sep 30 00:30:37 PDT 2009


On Tue, 2009-09-29 at 16:28 -0300, Ian Britten wrote:
> Bill Spitzak wrote:
> > I'm pretty certain this is antialiasing causing it. Clearing an 
> > antialised clip region will only partially clear the edge pixels.
> 
> That's what I had suspected/feared.
> I guess I would have hoped that a 'clear' operation would have
> cleared any pixels that were 'drawn' - Sortof like a symmetric, but
> inverse, operation.
> 
> > You should see if you can round up your clip region to pixel boundaries.
> 
> In the example I gave, the context has a default/1-1 scaling on it,
> and the clip points are all integral.
> However, that's not really the problem I'm seeing.  The problem is
> all the intermediate (diagonal) pixels between the path points that
> I'm seeing aren't being cleared, and hence my question.

Pixels are not points; they are usually thought of as squares.  Any
diagonal edge will only partially cover the pixels along it.

Antialiasing is always an approximation.  Cairo uses a coverage model
which produces smooth images but doesn't allow "painter's model erase"
operations that you may be accustomed to using on un-antialiased drawing
models.  Other coverage models are theoretically possible (and usually
implemented by 3D rasterisers), which have different tradeoffs.

-- 
------
From: Jonathan Morton
      jonathan.morton at movial.com




More information about the cairo mailing list