directx - How to apply shader to an Bitmap offline with SharpDX -


i want apply shader bitmap (offline processing) sharpdx. found sample on sharpdx homepage apply effect image offline processing. want apply shader.fx don't know how it. can me out?

here code snipset:

// effect 1 : bitmapsource - take decoded image data , bitmapsource     var bitmapsourceeffect = new d2.effects.bitmapsource(d2dcontext);     bitmapsourceeffect.wicbitmapsource = formatconverter;       // effect 2 : gaussianblur - give bitmapsource 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(); 

here shader.fx

vec2 warp(vec2 tex) { vec2 newpos = tex; float c = -81.0/20.0; float u = tex.x * 2.0 - 1.0; float v = tex.y * 2.0 - 1.0; newpos.x = c*u/((v*v) + c); newpos.y = c*v/((u*u) + c); newpos.x = (newpos.x + 1.0)*0.5; newpos.y = (newpos.y + 1.0)*0.5; return newpos; }  void mainimage( out vec4 fragcolor, in vec2 fragcoord )  { vec2 uv = fragcoord.xy / iresolution.xy;  if (uv.x < 0.5) {     uv.x = uv.x * 2.0;     fragcolor = texture2d(ichannel0, warp(uv)); } else {     uv.x = (uv.x - 0.5) * 2.0;     fragcolor = texture2d(ichannel0, warp(uv)); }   } 


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -