Text Outlining Using WPF Shader
I tried to google it out, but is there any sample Shader effect which I could use to produce an outlined FormattedText. I was able to get the outline by using BuildGeometry(开发者_开发技巧), but the performance is very poor!
PS: Since I'm new to this and still learning, it would be helpful if anyone can suggest whether it would be even possible or not.
Here's an easy option I whipped up, but not sure if it's exactly what you want. Just use an OuterGlowBitmapEffect
.
You can paste my example straight into Kaxaml to see what it looks like:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid Background="Black">
<TextBlock FontFamily="Arial" FontSize="36" FontWeight="Bold" Text="Text" Foreground="White">
<TextBlock.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="Orange" GlowSize="6" />
</TextBlock.BitmapEffect>
</TextBlock>
</Grid>
</Page>
精彩评论