public System.Drawing.Bitmap ProcessImage(Bitmap srcBitmap) { Point[,] ptRandJitter = new Point[_srcBitmap.Width, _srcBitmap.Height]; int nWidth = _srcBitmap.Width; int nHeight = _srcBitmap.Height; int newX, newY; short nHalf = (short)Math.Floor((double)_degree / 2); Random rnd = new Random(); for (int x = 0; x < nWidth; ++x) for (int y = 0; y < nHeight; ++y) { newX = rnd.Next(_degree) - nHalf; if (x + newX > 0 && x + newX < nWidth) ptRandJitter[x, y].X = newX; else ptRandJitter[x, y].X = 0; newY = rnd.Next(_degree) - nHalf; if (y + newY > 0 && y + newY < nWidth) ptRandJitter[x, y].Y = newY; else ptRandJitter[x, y].Y = 0; } OffsetCommand cmd = new OffsetCommand(_srcBitmap, ptRandJitter); return cmd.ProcessImage(_srcBitmap); }
public System.Drawing.Bitmap ProcessImage(Bitmap srcBitmap) { int nWidth = _srcBitmap.Width; int nHeight = _srcBitmap.Height; Point[,] pt = new Point[nWidth, nHeight]; int newX, newY; for (int x = 0; x < nWidth; ++x) for (int y = 0; y < nHeight; ++y) { newX = _cell - x % _cell; if (_grid && newX == _cell) pt[x, y].X = -x; else if (x + newX > 0 && x + newX < nWidth) pt[x, y].X = newX; else pt[x, y].X = 0; newY = _cell - y % _cell; if (_grid && newY == _cell) pt[x, y].Y = -y; else if (y + newY > 0 && y + newY < nHeight) pt[x, y].Y = newY; else pt[x, y].Y = 0; } OffsetCommand cmd = new OffsetCommand(_srcBitmap, pt); return cmd.ProcessImage(srcBitmap); }