Wave Filter Wave filterWater filter is a coordinate transformation to simulate the effect of water waves, so that the image presents the effect of water wave. This filter has an adjustable parameter: the degree of distortion of the water waves. The code is as follows;// /// //Wave filter /// &NB Sp /// source image. /// the degree of wave,0-100. &NB Sp the result image. Private Bitmap wavefilterprocess (Bitmap srcbitmap, int degree)   ; { Bitmap a = new Bitmap (srcbitmap); &NBS P int w = a.width; int h = a.height; &NBSP ; degree = degree * 32/100; degree = Math.max (0, Math.min (+ degree)); &nb Sp BITMAP DST = new Bitmap (w, h); System.Drawing. Imaging.bitmapdata srcdata = a.lockbits (new Rectangle (0, 0, W, h), System.draWing. Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb); System.Drawing.Imaging.BitmapData dstdata = DST. LockBits (New Rectangle (0, 0, W, h), System.Drawing.Imaging.ImageLockMode.ReadWrite, SYSTEM.DRAWING.IMAGING.PIXELFORMAT.FORMAT32BPPARGB); unsafe { byte* pIn = (byte*) srcData.Scan0.ToPo Inter (); byte* pOut = (byte*) dstData.Scan0.ToPointer ();   ; byte* p = null; int Strid E = srcdata.stride-w * 4; int newx = 0, Newy = 0; &N Bsp Double PI2 = Math.PI * 2.0; FOR (int y = 0; y < h; y++) { &N Bsp for (int x = 0; x < W; + +) and nbsp { NEWX = (int) (degree * Math.sin (PI2 * y/128.0) + x; newy = (int) (degree * Math.Cos (PI2 * x/128.0)) + y; NEWX = Math.min (w-1, Math.max (0, newx)); NEW Y = Math.min (h-1, Math.max (0, Newy)); p = pIn + newy * srcdata.stride + newx * 4; and nbsp POUT[0] = (byte) p[0]; pout[1] = (byte) p[1];&nb Sp pout[2] = (byte) p[2]; &NB Sp pout[3] = (byte) 255; &NBSP ; POut + + 4; } POut + stride; & nbsp } a.unlockbits (srcdata); & nbsp DST. Unlockbits (dstdata); } return DST;
Following
Original
Wave Filter
Finally put a complete C # version of the program demo:http://www.zealpixel.com/thread-59-1-1.html
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Image Filter Art---wave filter