示例#1
0
        LockedBufferBgra8(
            SoftwareBitmap bitmap,
            BitmapBufferAccessMode access)
        {
            if (bitmap.BitmapPixelFormat != BitmapPixelFormat.Bgra8)
            {
                throw new ArgumentException("Invalid BitmapPixelFormat");
            }

            m_buffer     = bitmap.LockBuffer(access);
            m_byteAccess = (IClosableByteAccess)(Object)m_buffer;

            byte *data;
            uint  capacity;

            m_byteAccess.Lock(out data, out capacity);
            m_locked = true;

            Description = m_buffer.GetPlaneDescription(0);
            PixelWidth  = Description.Width;
            PixelHeight = Description.Height;
            Data        = data + Description.StartIndex;

            m_rowIndex             = 0;
            m_rowData              = Data;
            m_rowReadableCapacity  = (access == BitmapBufferAccessMode.Write ? 0 : (uint)Description.Stride);
            m_rowWriteableCapacity = (access == BitmapBufferAccessMode.Read ? 0 : (uint)Description.Stride);
        }
示例#2
0
 LockBufferBgra8(
     this SoftwareBitmap bitmap,
     BitmapBufferAccessMode access)
 {
     return(new LockedBufferBgra8(bitmap, access));
 }