10

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!

mafu
  • 31,798
  • 42
  • 154
  • 247
Jens
  • 25,229
  • 9
  • 75
  • 117
  • Is there a reason why you don't want to use an ImageBrush ? I don't think there is an easy way to do it with other brushes... – Thomas Levesque Aug 19 '10 at 08:43
  • @Thomas: I suspected that. An ImageBrush scales badly, doesn't it? Optimally, the Brush would look the same both on my 96 DPI desktop and my 200 DPI embedded device. But if you know a tutorial on how to design a fitting image, I'd appriciate it, too =) – Jens Aug 19 '10 at 08:57

2 Answers2

3

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.

Merlyn Morgan-Graham
  • 58,163
  • 16
  • 128
  • 183
  • Thanks for the answer! This would not be easy to reproduce as a WPF brush, but may be worth a try. I'll leave the question open for a while longer =) – Jens Aug 23 '10 at 06:34
1

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?

Hendrik Wiese
  • 2,010
  • 3
  • 22
  • 49