Re: Adding an Edge to Text
From: Mike D Sutton _at_ Work (_at_)
Date: 06/07/04
- Next message: ShootingStar: ".png splash screen with gradient transparency"
- Previous message: Ludovic SOEUR: "Re: Save a JPEG picture without dll and ocx"
- In reply to: Lou: "Adding an Edge to Text"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Jun 2004 16:28:16 +0100
> i need to add edges and shodows to my text. I seem to get drop showdows but
> can't figure out edging?
<code snipped>
A simple shadow effect can be achieved by drawing the string offset horizontally and vertically beneath the text, however for a soft
shadow effect you'd need to create a back buffer, blur it and overlay this beneath the text - there's a demo of this on my site if
you need it.
As for the outline there's two ways you can go about it, the first is to draw the text either 4 or 8 times with different offsets
around the original position before drawing the final text string as Larry mentioned. The benefit of this technique is that it
gives you a nice anti-aliased edge (as long as the font you're drawing with is set to anti-alias) however for larger borders and on
very tin text the effect is quite quickly lost.
In these cases you may wish to opt for the GDI path technique instead; open a path bracket on the target DC and draw your text to
it, then close the path bracket and your path now has an outline of the text string which can be stroked and/or filled using the
StrokePath()/FillPath()/StrokeAndFillPath() API calls.
The benefit of this method is that the edge can be any thickness you wish, however you're limited to aliased drawing since GDI's pen
objects will be handling the drawing rather than the text engine.
Hope this helps,
Mike
- Microsoft Visual Basic MVP -
E-Mail: EDais@mvps.org
WWW: http://www.mvps.org/EDais/
- Next message: ShootingStar: ".png splash screen with gradient transparency"
- Previous message: Ludovic SOEUR: "Re: Save a JPEG picture without dll and ocx"
- In reply to: Lou: "Adding an Edge to Text"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|