freetype-devel
[Top][All Lists]
Advanced

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

RE: Shadows and Borders


From: Feinberg, Matthew
Subject: RE: Shadows and Borders
Date: Mon, 11 Sep 2000 22:01:13 -0400

> -----Original Message-----
> From: Adam Meyerowitz [mailto:address@hidden
> Sent: Monday, September 11, 2000 10:02 PM
> To: address@hidden
> Subject: RE: Shadows and Borders
> 
[snip]
> What exactly do you mean by stroking the glyph outlines?  I 
> have implemented
> shadowing and bordering before using glyph bitmaps but I 
> don't think it is the
> most elegant way, or maybe it was.

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.

> 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.

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.

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



reply via email to

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