SoftwareBitmapSource Class

Definition

Provides a source object, backed by a SoftwareBitmap, for properties that use a bitmap-format image source.

Equivalent WinUI class: Microsoft.UI.Xaml.Media.Imaging.SoftwareBitmapSource.

public ref class SoftwareBitmapSource sealed : ImageSource, IClosable
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class SoftwareBitmapSource sealed : ImageSource, IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class SoftwareBitmapSource sealed : ImageSource, IClosable
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class SoftwareBitmapSource : ImageSource, System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class SoftwareBitmapSource : ImageSource, System.IDisposable
Public NotInheritable Class SoftwareBitmapSource
Inherits ImageSource
Implements IDisposable
Inheritance
SoftwareBitmapSource
Attributes
Implements

Windows 10 requirements

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

Remarks

SoftwareBitmapSource lets you to use a SoftwareBitmap as an image source to be displayed using an ImageBrush or directly in an Image control. For example, you can use a SoftwareBitmapSource to display a photo just taken by a device's camera using the LowLagPhotoCapture class, to display an image you have manually decoded using the BitmapDecoder.GetSoftwareBitmapAsync method, or to display a custom IWICBitmap in advanced C++ scenarios where you want to manually manage image memory.

A SoftwareBitmap displayed in a XAML app must be in BGRA pixel format with pre-multiplied alpha values.

A SoftwareBitmap typically stores uncompressed image data. This means it can require a large amount of system memory compared to a compressed format like a Portable Network Graphics (PNG) or JPEG file. Therefore, using a SoftwareBitmap can increase the amount of system memory your app is using, which could impact your app’s performance. Because storing uncompressed image data can use a lot of memory, you can call the Dispose (C#/VB) or Close (C++) method to reduce memory usage when the SoftwareBitmap is longer needed. This causes the associated system resources to be freed immediately rather than waiting for garbage collection.

Constructors

SoftwareBitmapSource()

Initializes a new instance of the SoftwareBitmapSource class.

Equivalent WinUI constructor: Microsoft.UI.Xaml.Media.Imaging.SoftwareBitmapSource.SoftwareBitmapSource.

Properties

Dispatcher

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

Equivalent WinUI property: Microsoft.UI.Xaml.DependencyObject.Dispatcher.

(Inherited from DependencyObject)

Methods

ClearValue(DependencyProperty)

Clears the local value of a dependency property.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.ClearValue.

(Inherited from DependencyObject)
Close()

Disposes of the object and associated resources.

Equivalent WinUI method: Microsoft.UI.Xaml.Media.Imaging.SoftwareBitmapSource.Close.

Dispose()

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

GetAnimationBaseValue(DependencyProperty)

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.GetAnimationBaseValue.

(Inherited from DependencyObject)
GetValue(DependencyProperty)

Returns the current effective value of a dependency property from a DependencyObject.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.GetValue.

(Inherited from DependencyObject)
ReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if a local value is set.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.ReadLocalValue.

(Inherited from DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.RegisterPropertyChangedCallback.

(Inherited from DependencyObject)
SetBitmapAsync(SoftwareBitmap)

Sets the source SoftwareBitmap to be used as an image source.

Equivalent WinUI method: Microsoft.UI.Xaml.Media.Imaging.SoftwareBitmapSource.SetBitmapAsync.

SetValue(DependencyProperty, Object)

Sets the local value of a dependency property on a DependencyObject.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.SetValue.

(Inherited from DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.UnregisterPropertyChangedCallback.

(Inherited from DependencyObject)

Applies to

See also