BitmapSource.CopyPixels Method

Definition

Copies the bitmap pixel data.

Overloads

CopyPixels(Array, Int32, Int32)

Copies the bitmap pixel data into an array of pixels with the specified stride, starting at the specified offset.

CopyPixels(Int32Rect, Array, Int32, Int32)

Copies the bitmap pixel data within the specified rectangle into an array of pixels that has the specified stride starting at the specified offset.

CopyPixels(Int32Rect, IntPtr, Int32, Int32)

Copies the bitmap pixel data within the specified rectangle.

CopyPixels(Array, Int32, Int32)

Copies the bitmap pixel data into an array of pixels with the specified stride, starting at the specified offset.

C#
[System.Security.SecurityCritical]
public virtual void CopyPixels(Array pixels, int stride, int offset);
C#
public virtual void CopyPixels(Array pixels, int stride, int offset);

Parameters

pixels
Array

The destination array.

stride
Int32

The stride of the bitmap.

offset
Int32

The pixel location where copying starts.

Attributes

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CopyPixels(Int32Rect, Array, Int32, Int32)

Copies the bitmap pixel data within the specified rectangle into an array of pixels that has the specified stride starting at the specified offset.

C#
[System.Security.SecurityCritical]
public virtual void CopyPixels(System.Windows.Int32Rect sourceRect, Array pixels, int stride, int offset);
C#
public virtual void CopyPixels(System.Windows.Int32Rect sourceRect, Array pixels, int stride, int offset);

Parameters

sourceRect
Int32Rect

The source rectangle to copy. An Empty value specifies the entire bitmap.

pixels
Array

The destination array.

stride
Int32

The stride of the bitmap.

offset
Int32

The pixel location where copying begins.

Attributes

Remarks

An empty sourceRect value (specified as all zeros) copies the entire bitmap.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CopyPixels(Int32Rect, IntPtr, Int32, Int32)

Copies the bitmap pixel data within the specified rectangle.

C#
[System.Security.SecurityCritical]
public virtual void CopyPixels(System.Windows.Int32Rect sourceRect, IntPtr buffer, int bufferSize, int stride);
C#
public virtual void CopyPixels(System.Windows.Int32Rect sourceRect, IntPtr buffer, int bufferSize, int stride);

Parameters

sourceRect
Int32Rect

The source rectangle to copy. An Empty value specifies the entire bitmap.

buffer
IntPtr

A pointer to the buffer.

bufferSize
Int32

The size of the buffer.

stride
Int32

The stride of the bitmap.

Attributes

Remarks

An empty sourceRect value (specified as all zeros) copies the entire bitmap.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10