[cairo] Trying to figure out some rasterization problems

Behdad Esfahbod behdad at behdad.org
Sun Apr 21 08:29:28 PDT 2013


On 13-04-21 11:13 AM, David Kastrup wrote:
>>> >> Unfortunately, it _does_ make a difference.  Why do we care?  Because
>>> >> note stems are rectangles with rounded corners.  Not completely circular
>>> >> stroke ends, just rounded corners.  If we care for stroke adjustment
>>> >> (which we do), that means our actual shape needs to be represented as an
>>> >> intersection of a stroke-adjusted rectangle and clipping off the rounded
>>> >> corners.  That clipping apparently removes too much.  An easy solution
>>> >> appears to be to restroke the middle part of the rectangle without any
>>> >> clipping.  Which comes to problem b) which I think Cairo might be
>>> >> responsible for:
>> >
>> > I still have no idea what you are talking about.  Perhaps some images
>> > would help?
> What's wrong with "a rectangle with rounded corners"?  At any rate,
> stroke adjustment deals with rasterization on a black&white device: if
> you have a thin line, the normal PostScript/PDF way is to color all
> pixels black that have any part inside covered by the filled/stroked
> region.  For thin lines, this adds up to one line of blackness too much
> on each side.  Stroke adjustment checks the total width and reduces it
> (starting on the side with the larger overhang) by 1 pixel until it is
> not off more than half a pixel.  So 0, 1 or two pixels are culled from
> the width, depending on where it lies in the rasterization.

Ok, it makes more sense now.

But I have to ask: in 2013, who cares about stroke adjustment?  Just draw a
shape and fill it.  I'm sure no print would look bad.


-- 
behdad
http://behdad.org/


More information about the cairo mailing list