Exemplo n.º 1
0
    public void Unlock(bool writePixels = true)
    {
        if (!m_locked)
        {
            throw new Exception("Bitmap not locked.");
        }

#if !USE_UNSAFE_FUNCTIONS
        // Write the color values back to the bitmap
        if (writePixels)
        {
            Marshal.Copy(m_bitmapDataCopy, 0, m_bitmapPtr, m_bitmapDataCopy.Length);
        }
#endif

        // Unlock the bitmap
        BitmapRef.UnlockBits(m_bitmapData);

        m_bitmapData      = null;
        m_bitmapSizeBytes = 0;
#if !USE_UNSAFE_FUNCTIONS
        //m_rgbValues = null;  // don't null this, keep this memory around for re-use
        m_bitmapPtr = (IntPtr)0;
#endif

        m_locked = false;
    }
Exemplo n.º 2
0
    public void Unlock(bool writePixels)
    {
        if (!m_locked)
        {
            throw new Exception("Bitmap not locked.");
        }

        // Write the color values back to the bitmap
        if (writePixels)
        {
            Marshal.Copy(m_rgbValues, 0, m_bitmapPtr, m_rgbValues.Length);
        }

        // Unlock the bitmap
        BitmapRef.UnlockBits(m_bitmapData);

        //m_rgbValues = null;  // keep this memory around for re-use
        m_bitmapData = null;
        m_bitmapPtr  = (IntPtr)0;

        m_locked = false;
    }