[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] Re: help modifying freetype demo.
From: |
Peter Montgomery |
Subject: |
Re: [Freetype] Re: help modifying freetype demo. |
Date: |
Fri, 01 Nov 2002 09:52:52 -0800 |
George,
You need to treat the grayscale image created by FreeType as an alpha
channel. If the system you are using does not need pre-multiplied RGB,
then all you have to do is to create an RGBA image that's compatible
with your Mesa context, fill it with a solid color, and then replace the
alpha with the FreeType image. If you need pre-multiplied RGB, then
you'll do the previous steps and then multiply RGB by A at each pixel.
Remember, you can quickly special case alpha = 255 and alpha = 0 by
simply leaving RGB alone or setting it to 0,0,0 respectively. As for
the rest, the pseudo-code looks like this:
Red Pixel = Red Pixel * ( (1 / 255) * Alpha)
Green Pixel = Green Pixel * ( (1 / 255) * Alpha)
Blue Pixel = Blue Pixel * ( (1 / 255) * Alpha)
Be aware that this is a very inefficient way (using division, floating
point math, etc) to achieve the correct result, but at least it shows
you what is going on.
Thanks,
PeterM
----- Original Message -----
From: "George H" <address@hidden>
To: <address@hidden>
Sent: Thursday, October 31, 2002 1:09 PM
Subject: [Freetype] Re: help modifying freetype demo.
> Hello,
>
> I would like to modify the ftview freetype demo, to work with an
off-screen
> Mesa context I am using.
>
> It's my understanding the the MIGS portion of the demo is setup to
only
> display grayscale characters. I am having trouble understanding how I
could
> add support for rendering characters in a variety of colors.
>
> Any help would be greatly appreciated. Also, if any one is aware of
other C
> interfaces to freetype I would love to see them.
>
> Thank you.
> George
- Re: [Freetype] Re: help modifying freetype demo.,
Peter Montgomery <=