Export (0) Print
Expand All

WriteableBitmap.Pixels Property

Silverlight

Gets an array representing the 2-D texture of the bitmap.

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

public int[] Pixels { get; }

Property Value

Type: System.Int32[]
An array of integers representing the 2-D texture of the bitmap.

ExceptionCondition
SecurityException

The WriteableBitmap is created from protected content. The Pixels array is inaccessible in this case.

When assigning colors to pixels in your bitmap, use pre-multiplied colors. The format used by the Silverlight WriteableBitmap is ARGB32 (premultiplied RGB). Similarly, if reading values from the array, treat these as ARGB32 (premultiplied RGB) values if you are reprocessing or rendering based on the values.

The length of the array is based on construction behavior.

Position of pixels in the array is that .Pixels[0] is the upper left corner of the image. .Pixels[1] is the pixel in the same row and to the immediate right, and so on. Scenarios that use WriteableBitmap either for algorithm-created images or for image format conversion typically use the Pixels array as part of a loop that goes through the entire array and sets integer values, representing the format pixels of the desired image.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft