예제 #1
0
        public void LockBits()
        {
            if( Bitmap == null ) throw new InvalidOperationException( "Underlying bitmap is null." );
            if( data != null ) return;

            data = ByteBuffer.AllocateDirect( Bitmap.Width * Bitmap.Height * 4 );
            Bitmap.CopyPixelsToBuffer( data );
            Scan0 = data.GetDirectBufferAddress();
            scan0Byte = (byte*)Scan0;
            Stride = Bitmap.Width * 4;
            Width = Bitmap.Width;
            Height = Bitmap.Height;
        }