0

In WPF, when defining ShaderEffects, we use

ShaderEffect.RegisterPixelShaderSamplerProperty()

to introduce pixel shader sampler properties (the ones that are fed to the actual pixel shader, and are of type Brush); but how can these properties be retrieved from a ShaderEffect class?

Arash
  • 203
  • 1
  • 8

1 Answers1

1

RegisterPixelShaderSamplerProperty creates a new DependencyProperty which becomes available on the class which you derived from ShaderEffect.

You can create a CLR wrapper in order to access it.

public static readonly DependencyProperty InputProperty =
    ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(MyShaderEffect), 0);

public Brush Input
{
    get
    {
        return (Brush)GetValue(InputProperty);
    }
    set
    {
        SetValue(InputProperty, value);
    }
}

Here is a link to a book useful when writing shaders for XAML/WPF.

Colin Smith
  • 12,375
  • 4
  • 39
  • 47