Exemplo n.º 1
0
        internal byte[] GetBitmapBytes(Bitmap bitmap)
        {
            byte[] bitmapBytes = new byte[bitmap.Width * bitmap.Height * 3 + 40 + 14 + 1];
            IntPtr hbitmap     = bitmap.GetHbitmap();

            try
            {
                this.GetBitmapBytes(bitmap.Width, bitmap.Height, hbitmap, ref bitmapBytes);
            }
            finally
            {
                NativeHelpers.DeleteObject(hbitmap);
            }
            return(bitmapBytes);
        }
Exemplo n.º 2
0
        internal object GetColourPixelsFromBitmap(Bitmap bitmap, FlipMode flipMode, out byte[] rawBitmapBytes)
        {
            int[,,] bitmapPixels = new int[bitmap.Width, bitmap.Height, 3];
            rawBitmapBytes       = new byte[bitmap.Width * bitmap.Height * 3 + 40 + 14 + 1];
            IntPtr hbitmap = bitmap.GetHbitmap();

            try
            {
                this.GetColourPixelsFromBitmap(bitmap.Width, bitmap.Height, 8, flipMode, hbitmap, ref bitmapPixels, ref rawBitmapBytes);
            }
            finally
            {
                NativeHelpers.DeleteObject(hbitmap);
            }
            return((object)bitmapPixels);
        }
Exemplo n.º 3
0
        internal object GetMonochromePixelsFromBitmap(Bitmap bitmap, LumaConversionMode conversionMode, FlipMode flipMode, out byte[] rawBitmapBytes)
        {
            int[,] bitmapPixels = new int[bitmap.Width, bitmap.Height];
            rawBitmapBytes      = new byte[bitmap.Width * bitmap.Height * 3 + 40 + 14 + 1];
            IntPtr hbitmap = bitmap.GetHbitmap();

            try
            {
                this.GetMonochromePixelsFromBitmap(bitmap.Width, bitmap.Height, 8, flipMode, hbitmap, ref bitmapPixels, ref rawBitmapBytes, (int)conversionMode);
            }
            finally
            {
                NativeHelpers.DeleteObject(hbitmap);
            }
            return((object)bitmapPixels);
        }