Example #1
0
 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
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }