Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

WriteableBitmap.WritePixels Method (Int32Rect, Array, Int32, Int32, Int32)

Updates the pixels in the specified region of the bitmap.

Namespace:  System.Windows.Media.Imaging
Assembly:  PresentationCore (in PresentationCore.dll)

public void WritePixels(
	Int32Rect sourceRect,
	Array sourceBuffer,
	int sourceBufferStride,
	int destinationX,
	int destinationY
)

Parameters

sourceRect
Type: System.Windows.Int32Rect

The rectangle in sourceBuffer to copy.

sourceBuffer
Type: System.Array

The input buffer used to update the bitmap.

sourceBufferStride
Type: System.Int32

The stride of the input buffer, in bytes.

destinationX
Type: System.Int32

The destination x-coordinate of the left-most pixel in the back buffer.

destinationY
Type: System.Int32

The destination y-coordinate of the top-most pixel in the back buffer.

ExceptionCondition
ArgumentOutOfRangeException

One or more of the following conditions is true.

sourceRect falls outside the bounds of the WriteableBitmap.

destinationX or destinationY is outside the bounds of the WriteableBitmap.

sourceBufferStride < 1

ArgumentNullException

sourceBuffer is null.

ArgumentException

sourceBuffer has a rank other than 1 or 2, or its length is less than or equal to 0.

Call the WritePixels method to update the WriteableBitmap automatically with the contents of sourceBuffer. Calling this method is the equivalent of using the Lock and Unlock workflow described in the WriteableBitmap class remarks.

NoteNote

Use this overload in partial trust.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1, 3.0 SP2

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Show:
© 2015 Microsoft