Sorry if I make this sound a little simplified, I'm not sure how much you know about gfx programming or even the methods you use (I would do it with HLSL myself).
, , - , x/y r/g. :
Texture inputImage
color (x, y) = inputImage (x + distortionMap (x, y).R, y + distortionMap (x, y).G)
( , , , , , 0,5, )
, , ( - , , , - ).