[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Shadows and Borders
From: |
Adam Meyerowitz |
Subject: |
RE: Shadows and Borders |
Date: |
Mon, 11 Sep 2000 22:18:39 -0400 |
The outline of a glyph is a series of on- and off-curve points. By
drawing straight and curved lines through them, you can outline the
character. IIRC, someone on the list was working on code to do just
that.
I would be very interested in seeing what they have done. Is there anyway
to get the freetype library to only generate the outline of the character
instead
of a filled character bitmap? Unfortunately compositing this outline with
the filled
character bitmap would lead to the border taking up some of the original
character
space. The border should be additional pixels and not take up pixels from the
character body (well in my application at least!)
> Basically I use a second buffer and for each pixel do a
> shadow or border.
> For a border I move up and to the left border pixels and then
> draw a filled
> rectangle
> border*2+1 wide and high. Then I combine both buffers (the
> glyph and the
> border
> buffer) to make a single bordered character buffer. For a shadow I
> basically do what
> you mentioned for each pixel and then combine the two buffers.
>
> This might be the only way, but I thought there might be some
> other more
> interesting
> ways.
Well, stroking the outline would probably look better, particularly if
you're working with antialiased characters.
Yes that is true. In my method there is no way of carrying the antialiasing
into the border (this could carry into the shadow though!). I'd have to see
stroked outlines in action to really understand what you were referring to.
As for shadowing-- if you're anti-aliasing, I'd actually draw the
character twice rather than doing a pixel-by-pixel operation. FreeType
will give you a grayscale bitmap of the character. Just composite that
grayscale bitmap into your target canvas (which could be another bitmap
or the screen or whatever...) twice, in different positions. I'd guess
it would look better than the method you described.
Actually the method I described looks very nice but is comparable to what
you describe. The problem arises when you want a shadow that is wider
then the regular character. My method achieves this very easily while yours
might not.
Alternatively, you could render two copies of the glyph -- one of which
would be used for the shadow and could be transformed differently (for
example, stretched to make the shadow appear to disappear into the
distance).
There are lots of methods for shadowing and outlining; it really depends
on exactly what you're trying to accomplish.
--Matthew
I would like to generate excellent looking characters that are presentable
on NTSC
video screens (very bandwidth limited). Antialiasing is a must. I would
like to be able
to do texture mapped fonts (pretty easy in 2d space), with various shadows
and borders
with varying opacity, etc.
Thanks
Adam
- Shadows and Borders, Adam Meyerowitz, 2000/09/09
- Shadows and Borders, Adam Meyerowitz, 2000/09/12
- RE: Shadows and Borders, Feinberg, Matthew, 2000/09/12
- RE: Shadows and Borders, Adam Meyerowitz, 2000/09/12
- RE: Shadows and Borders, Feinberg, Matthew, 2000/09/12
- RE: Shadows and Borders,
Adam Meyerowitz <=