C#

Java code posted by Priya
created at 17 May 18:50

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  // copy rectangle
            int[] srcPixels = src.Pixels;
            int[] dstPixels = dst.Pixels;
            int srcOffset = (int)(src.PixelWidth * rc.Y + rc.X) * 4;
            int dstOffset = (int)(dst.PixelWidth * pt.Y + pt.X) * 4;
            int max = (int)rc.Height;
            int len = (int)rc.Width * 4;

            for (int y = 0; y < max; y++)
            {
                Buffer.BlockCopy(srcPixels, srcOffset, dstPixels, dstOffset, len);
                srcOffset += src.PixelWidth * 4;
                dstOffset += dst.PixelWidth * 4;
            }
585 Bytes in 3 ms with coderay