private void fillColors() { imgColors = new Color[userImage.Width, userImage.Height]; LockBitmap lImg = new LockBitmap(userImage); lImg.LockBits(); for (int x = 0; x < userImage.Width; ++x) { for (int y = 0; y < userImage.Height; ++y) { imgColors[x, y] = lImg.GetPixel(x, y); } } lImg.UnlockBits(); }
private Bitmap createNewImage() { Bitmap resultImg = new Bitmap(newWidth, newHeight); LockBitmap lockRes = new LockBitmap(resultImg); lockRes.LockBits(); for (int x = 0; x < newWidth; ++x) { for (int y = 0; y < newHeight; ++y) { lockRes.SetPixel(x, y, imgColors[x, y]); } } lockRes.UnlockBits(); return(resultImg); }