public UnsafeBitmap(UnsafeBitmap other) { // copy the bitmap Bitmap = (Bitmap)other.Bitmap.Clone(); graphics = Graphics.FromImage(Bitmap); bitmapWidth = other.bitmapWidth; bitmapHeight = other.bitmapHeight; // the remaining parameters are not set, as the bitmap is in unlocked state }
public UnsafeBitmap Transpose() { UnsafeBitmap result = new UnsafeBitmap(bitmapHeight, bitmapWidth); result.LockBitmap(); for (int i = 0; i < bitmapWidth; i++) { for (int j = 0; j < bitmapHeight; j++) { result.SetPixel(j, i, GetPixel(i, j)); } } return(result); }
public UnsafeBitmap Lighter() { UnsafeBitmap result = new UnsafeBitmap(bitmapWidth, bitmapHeight); result.LockBitmap(); for (int i = 0; i < bitmapWidth; i++) { for (int j = 0; j < bitmapHeight; j++) { PixelData p = GetPixel(i, j); result.SetPixel(i, j, Color.FromArgb(Math.Min(255, p.red + 20), Math.Min(255, p.green + 20), Math.Min(255, p.blue + 20))); } } return(result); }