Esempio n. 1
0
        /// <summary>
        /// Creates a new, blank BytesBitmap with the specified width, height, and pixel format.
        /// </summary>
        public BytesBitmap(int width, int height, PixelFormat format)
        {
            _pixelFormatSize = Image.GetPixelFormatSize(format);
            _stride          = width * _pixelFormatSize / 8;
            int padding = _stride % 4;

            _stride += (padding == 0) ? 0 : 4 - padding;
            _bytes   = new SharedPinnedByteArray(_stride * height);
            _bitmap  = new Bitmap(width, height, _stride, format, _bytes.Address);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a new, blank BytesBitmap with the specified width, height, and pixel format.
 /// </summary>
 public BytesBitmap(int width, int height, PixelFormat format)
 {
     _pixelFormatSize = Image.GetPixelFormatSize(format);
     _stride = width * _pixelFormatSize / 8;
     int padding = _stride % 4;
     _stride += (padding == 0) ? 0 : 4 - padding;
     _bytes = new SharedPinnedByteArray(_stride * height);
     _bitmap = new Bitmap(width, height, _stride, format, _bytes.Address);
 }