ReadableBitmapDataExtensionsToWriteableBitmap(IReadableBitmapData) Method

Converts the specified source to a WriteableBitmap.

Definition

Namespace: KGySoft.Drawing.Wpf
Assembly: KGySoft.Drawing.Wpf (in KGySoft.Drawing.Wpf.dll) Version: 9.0.0
C#
public static WriteableBitmap ToWriteableBitmap(
	this IReadableBitmapData source
)

Parameters

source  IReadableBitmapData
The source IReadableBitmapData instance to convert.

Return Value

WriteableBitmap
A WriteableBitmap instance that has the same content as the specified source.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IReadableBitmapData. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

  Note

This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. Use the BeginToWriteableBitmap or ToWriteableBitmapAsync (in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.

The result WriteableBitmap will have the closest possible PixelFormat to source. To create a result with a specific pixel format, use the ToWriteableBitmap(IReadableBitmapData, PixelFormat, IQuantizer, IDitherer) overload instead.

Exceptions

See Also