使用 WPF 着色器绘制文本大纲

发布于 2024-10-06 21:15:35 字数 215 浏览 0 评论 0原文

我试图用谷歌搜索它,但是有没有任何示例着色器效果,我可以用它来生成概述的格式化文本。我能够使用 BuildGeometry() 获得轮廓,但性能非常差!

outlined Text

PS:由于我对此很陌生并且仍在学习,如果有人可以建议是否会这样做,那将会很有帮助甚至可能或不可能。

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!

outlined Text

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

反差帅 2024-10-13 21:15:35

这是我提出的一个简单的选择,但不确定它是否正是您想要的。只需使用 OuterGlowBitmapEffect 即可。

您可以将我的示例直接粘贴到 Kaxaml 中查看其外观:

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

alt text

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>

alt text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文