freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] Freetype Scan Converter


From: Robin Watts
Subject: [ft] Freetype Scan Converter
Date: Tue, 29 Dec 2009 00:59:51 GMT
User-agent: Messenger-Pro/2.62 (MsgServe/2.05) (RISC-OS/4.34) POPstar/2.03

Hi,

I've been reading through the ftgrays.c file for a while, trying to
get my head around your intriguing scanline conversion code.

Apologies if this is an FAQ, but is there some documentation for the
algorithm anywhere? I've looked in the documentation and googled too,
but other than a note saying "it uses the same algorithm as libArt",
I haven't been able to find anything. LibArt in turn doesn't appear
to document it anywhere I can see. If I'm being blind, then I
apologise - any pointers would be much appreciated.

Failing there being a ready written explaination somewhere, if an
expert could spare the time to correct my understanding, I'd be
hugely grateful.

I understand that each cell stores a "cover" and an "area" value for
a pixel, but the exact definition of the values stored there is
eluding me.

Cover appears to be the vertical extent of the pixel that is covered,
or, if you like, the delta for the winding sum as we move across a
scanline.

Area appears to be twice the sum of the areas to the left of lines
moving upwards through the pixel, minus twice the sum of the areas to
the right of lines moving downwards through the pixel.

I can see (I think) how this can be used to give the correct results
in simple cases, but in more complex cases (such as 2 lines crossing
within a pixel, or multiple lines crossing the pixel in the same
direction), my tiny brain can't figure it out.

For instance, consider 2 lines each crossing a pixel from corner to
corner at 45 degrees (forming an X shape), one upwards and one
downwards.

Processing the first one would cause the cell to be given a coverage
of ONE_PIXEL (256), and an area of 65536. Processing the second would
cause the coverage to have ONE_PIXEL subtracted from it, and the area
of 65536 subtracted from that. My understanding says that the cell
ends up with a coverage of 0 and an area of 0. Surely I must be
mistaken?

Any help people can give would be gratefully recieved. Thanks,

Robin
-- 
Robin Watts,             Email: <mailto:address@hidden>
Warm Silence Software,   WWW:   <http://www.wss.co.uk/>
P.O.Box 28, Woodstock,   Tel:   01608 737172 (or Mobile: 07885 487642)
Oxfordshire, OX20 1XX    Fax:   01608 737172




reply via email to

[Prev in Thread] Current Thread [Next in Thread]