SKAutoLockPixels Class

Definition

Convenience class used to lock and unlock the bitmap pixels in a using statement.

public class SKAutoLockPixels : IDisposable
Inheritance
SKAutoLockPixels
Implements

Examples

SKBitmap bitmap = ...;

using (new SKAutoLockPixels(bitmap)) {
    // get a pointer to the pixels
    bitmap.GetPixels();

    // use the pointer

    // automatically unlock the pixels
}

Remarks

This class can be used in a using statement to lock the pixels of the bitmap allowing you to read those pixels. The pixels are automatically unlocked by virtue of having the Dispose() method unlock the bitmap pixels.

Constructors

SKAutoLockPixels(SKBitmap)

Lock the bitmaps pixels.

SKAutoLockPixels(SKBitmap, Boolean)

Lock the bitmaps pixels.

Methods

Dispose()

Disposes the pixel locker, unlocking the pixels of the bitmap.

This operation will not do anything if you had previously manually called the Unlock() method.

Unlock()

Unlocks the pixels of the bitmap.

Applies to