Sdílet prostřednictvím


SoftwareBitmap Class

Definition

Represents an uncompressed bitmap.

public ref class SoftwareBitmap sealed : IClosable
/// [Windows.Foundation.Metadata.Activatable(Windows.Graphics.Imaging.ISoftwareBitmapFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.GCPressure]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SoftwareBitmap final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.GCPressure]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Graphics.Imaging.ISoftwareBitmapFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class SoftwareBitmap final : IClosable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Graphics.Imaging.ISoftwareBitmapFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.GCPressure]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class SoftwareBitmap : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.GCPressure]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Graphics.Imaging.ISoftwareBitmapFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class SoftwareBitmap : System.IDisposable
function SoftwareBitmap(format, width, height, alpha)
Public NotInheritable Class SoftwareBitmap
Implements IDisposable
Inheritance
Object Platform::Object IInspectable SoftwareBitmap
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

Sample applications that use this class include the Camera frames sample.

For a code example showing how to access pixel data, see the WriteableBitmap.PixelBuffer property (also see CopyToBuffer, and CopyFromBuffer).

Remarks

This class provides a representation of a bitmap that makes it easy to use with different imaging APIs. Use GetSoftwareBitmapAsync to create a SoftwareBitmap from a stream resource such as an image file.

Use CopyToBuffer and CopyFromBuffer to copy pixel data back and forth between a SoftwareBitmap and the PixelBuffer of a WriteableBitmap. Use CreateCopyFromSurfaceAsync to create a SoftwareBitmap from an IDirect3DSurface. Use ISoftwareBitmapNativeFactory::CreateFromMF2DBuffer2 to create a SoftwareBitmap from an IMF2DBuffer2. Use ISoftwareBitmapNativeFactory::CreateFromIWICBitmap to create a SoftwareBitmap from an IWICBitmap.

Constructors

SoftwareBitmap(BitmapPixelFormat, Int32, Int32, BitmapAlphaMode)

Initializes a new instance of the SoftwareBitmap class.

SoftwareBitmap(BitmapPixelFormat, Int32, Int32)

Initializes a new instance of the SoftwareBitmap class.

Properties

BitmapAlphaMode

Gets the alpha mode of the software bitmap.

BitmapPixelFormat

Gets the pixel format of the software bitmap.

DpiX

Gets or sets the dots per inch of the software bitmap in the X direction.

DpiY

Gets or sets the dots per inch of the software bitmap in the Y direction.

IsReadOnly

Gets a value indicating whether the software bitmap can be modified.

PixelHeight

Gets the height of the software bitmap, in pixels.

PixelWidth

Gets the width of the software bitmap, in pixels.

Methods

Close()

Disposes of the object and associated resources.

Convert(SoftwareBitmap, BitmapPixelFormat, BitmapAlphaMode)

Converts an existing SoftwareBitmap to a SoftwareBitmap with a different pixel format or alpha mode.

Convert(SoftwareBitmap, BitmapPixelFormat)

Converts an existing SoftwareBitmap to a SoftwareBitmap with a different pixel format.

Copy(SoftwareBitmap)

Creates a copy of the provided SoftwareBitmap object.

CopyFromBuffer(IBuffer)

Copies the pixel data from an IBuffer into the SoftwareBitmap.

CopyTo(SoftwareBitmap)

Copies the current SoftwareBitmap into the provided SoftwareBitmap object.

CopyToBuffer(IBuffer)

Copies the software bitmap pixel data into the specified IBuffer.

CreateCopyFromBuffer(IBuffer, BitmapPixelFormat, Int32, Int32, BitmapAlphaMode)

Creates a new SoftwareBitmap by performing a deep copy of the provided buffer. Modifications to the data in the new SoftwareBitmap will not effect the buffer from which it was created.

CreateCopyFromBuffer(IBuffer, BitmapPixelFormat, Int32, Int32)

Creates a new SoftwareBitmap by performing a deep copy of the provided buffer. Modifications to the data in the new SoftwareBitmap will not effect the buffer from which it was created.

CreateCopyFromSurfaceAsync(IDirect3DSurface, BitmapAlphaMode)

Asynchronously creates a new SoftwareBitmap by performing a deep copy of the provided IDirect3DSurface. Modifications to the data in the new SoftwareBitmap will not effect the surface from which it was created.

CreateCopyFromSurfaceAsync(IDirect3DSurface)

Asynchronously creates a new SoftwareBitmap by performing a deep copy of the provided IDirect3DSurface. Modifications to the data in the new SoftwareBitmap will not effect the surface from which it was created.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetReadOnlyView()

Gets a read-only representation of the SoftwareBitmap object.

LockBuffer(BitmapBufferAccessMode)

Gets a BitmapBuffer object that allows you to operate directly on the software bitmap's pixel data.

Applies to

See also