我想使用sharpdx将着色器应用于位图(离线处理)。我在SharpDX主页上找到了一个样本,可以通过离线处理将效果应用于图像。现在我想将shader.fx应用于它,但我不知道该怎么做。 谁能帮我吗?
以下是代码片段:
# This one will fail
$usfd = [System.IO.IsolatedStorage.IsolatedStorageFile]::GetUserStoreForDomain()
# Inspect the current AppDomain's Evidence
[threading.thread]::GetDomain().Evidence
# Modify the current AppDomain's Evidence
$evidence = new-object System.Security.Policy.Evidence
$zone = new-object System.Security.Policy.Zone('MyComputer')
$evidence.AddHost($zone)
$currentAppDomain = [threading.thread]::GetDomain()
$securityIdentityField=$currentAppDomain.GetType().GetField('_SecurityIdentity','Instance,NonPublic')
$securityIdentityField.SetValue($currentAppDomain, $evidence)
# Inspect the current AppDomain's Evidence
[threading.thread]::GetDomain().Evidence
# This one will succeed
$usfd = [System.IO.IsolatedStorage.IsolatedStorageFile]::GetUserStoreForDomain()
以下是shader.fx
// Effect 1 : BitmapSource - take decoded image data and get a BitmapSource from it
var bitmapSourceEffect = new d2.Effects.BitmapSource(d2dContext);
bitmapSourceEffect.WicBitmapSource = formatConverter;
// Effect 2 : GaussianBlur - give the bitmapsource a gaussian blurred effect
var gaussianBlurEffect = new d2.Effects.GaussianBlur(d2dContext);
gaussianBlurEffect.SetInput(0, bitmapSourceEffect.Output, true);
gaussianBlurEffect.StandardDeviation = 5f;
d2dContext.BeginDraw();
d2dContext.DrawImage(gaussianBlurEffect);
d2dContext.EndDraw();