开发者

Text Outlining Using WPF Shader

开发者 https://www.devze.com 2023-01-30 11:35 出处:网络
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 p

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!

Text Outlining Using WPF Shader

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>

Text Outlining Using WPF Shader

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号