freetype-devel
[Top][All Lists]
Advanced

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

[Devel] RE: Gamma correction implementation


From: Yao Zhang
Subject: [Devel] RE: Gamma correction implementation
Date: Tue, 2 Apr 2002 01:14:28 -0500 (EST)

On Thu, 7 Mar 2002, Simon Harvey wrote:

> I've been looking at the experimental GRAYS_USE_GAMMA part of ftgrays.c
> and I can't see how it solves the following problem:

My understanding is that after FT_Load_Glyph() and FT_Outline_Get_Bitmap(),
the bitmap (or graymap in the case of anti-aliasing) obtained is always
rendered as white text on black background.  In order to draw black text
on white background, you need to inverse it yourself.  So the contrast
is enhanced in both cases.

> If white text is being rendered on a black background and a pixel is
> deemed to have 50% coverage, then the RGB value when gamma corrected might
> need to be 192,192,192 to achieve 50% brightness. If the same pixel is
> part of black text being rendered on a white background, it should also
> have RGB=192,192,192. However, the scheme in ftgrays.c would correct the
> *coverage* to 192, ultimately being rendered as 63,63,63 and exacerbating
> the aliasing problem by making the glyph "ink heavy".

I don't see there is a problem here.  For black text on white background,
the text pixel value is drawn as 63, but the background pixel value
is 255: high contrast as we want.

The problem I can see is when the background is gray.  Maybe something like

    if (background pixel value < 128) {
        /* dark background */
        no inverse;
    } else {
        /* bright background */
        inverse;
    }

should be used.  Even in this case, gamma correction still enhances 
contrast and looks better.

GRAYS_USE_GAMMA is an experimental feature, but I find I cannot
live without it.  Just like byte code interpreter, the first thing I do
with an updated system is to turn on both: the byte code interpreter and
gamma correction.  So far, I haven't encounter any problem with it.  The
text readability improves tremendously.

Regards,

Yao Zhang




reply via email to

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