WPF 中的拉丝钢刷?

发布于 2024-09-15 13:22:54 字数 123 浏览 5 评论 0原文

我正在寻找创建具有拉丝钢外观的 WPF 画笔的想法,类似于 MacOSX Panther 风格,最好不诉诸 ImageBrush。 有没有一种时髦的方法来使用 GradientBrush 来创建这种效果?

提前致谢!

I am looking for ideas to create a WPF Brush with a brushed steel look, similar to the MacOSX Panther style, preferably without resorting to an ImageBrush.
Is there a funky way to use a GradientBrush to create this effect?

Thanks in advance!

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

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

发布评论

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

评论(2

夏有森光若流苏 2024-09-22 13:22:54

我不知道如何使用编程画笔轻松做到这一点,但是当我使用 Photoshop 创建拉丝钢效果时,我基本上创建了噪点,然后沿拉丝方向涂抹(模糊)它:

http://www.adamdorman.com/tutorials/brushed_steel_tutorial.php

正如有人在评论中提到的,您可以想要做到这一点,并创建某种(重复?)图像画笔。如果您希望以编程方式生成拉丝钢效果,您可以编写一个均值过滤器来为您进行模糊处理。生成噪声非常简单:)

实现均值滤波器的示例:

http ://homepages.inf.ed.ac.uk/rbf/HIPR2/mean.htm

修改它以具有 Nx1 矩阵,或者为不在当前行上的权重设置较小(零),您将获得水平模糊。

I don't know how to do this easily with programmatic brushes, but when I have used Photoshop to create a brushed steel effect, I essentially created noise, then smeared (blurred) it in the direction of the brushing:

http://www.adamdorman.com/tutorials/brushed_steel_tutorial.php

As someone mentioned in comments, you may want to do this, and create some sort of (repeating?) image brush. If you want your brushed steel effect to be programmatically generated, you could write a mean filter to do the blur for you. Generating noise is simple enough :)

An example of implementing a mean filter:

http://homepages.inf.ed.ac.uk/rbf/HIPR2/mean.htm

Modify this to have a Nx1 matrix, or have small (zero) for weights not on the current line, and you will have a horizontal blur.

小帐篷 2024-09-22 13:22:54

您可以使用带有许多不同灰色调的 GradientStop 的旋转 LinearGradientBrush。嗯,这至少是一种方法。为了使其可扩展,我想,您需要以某种方式将 GradientStops 设置为只有一个像素宽,这可能需要将填充对象的大小提供给画笔。可能会成为一项艰巨的任务,但这就是真正的黑客的命运,不是吗?

You could use a rotated LinearGradientBrush with many GradientStops in different grey tones. Well, it's at least an approach. For it to be scalable you would somehow need to make the GradientStops just one pixel wide which probably requires giving the size of the filled object to the brush, I guess. Might become a difficult task, but that's the fate of a real hacker, isn't it?

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