2012-08-17 23 views
0

在WPF中,限定ShaderEffects時,我們使用如何在wpf中獲取ShaderEffect的SamplerProperties?

ShaderEffect.RegisterPixelShaderSamplerProperty() 

引進像素着色器採樣器性能(被饋送到實際像素着色器的那些,並且是類型刷);但是如何從ShaderEffect類中檢索這些屬性?

回答

0

RegisterPixelShaderSamplerProperty創建一個新的DependencyProperty,該類可從您從ShaderEffect派生的類上使用。

您可以創建一個CLR包裝器以訪問它。

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

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

這是一本指向爲XAML/WPF編寫着色器的書的鏈接。