C# Class WinRTXamlToolkit.Imaging.IBufferExtensions.PixelBufferInfo

Gives access to the pixels of a WriteableBitmap given an IBuffer exposed by Pixels property.
Note that creating this object copies the pixels buffer into the Bytes byte array for quick pixel access and the array needs to be copied back to the pixels buffer to update the bitmap with a call to UpdateFromBytes(). This is acceptable for convenience and possibly best for performance in some scenarios, but it does add some upfront overhead as well overhead to update the bitmap at the end. This is only a theory and for better performance it might be good to test different approaches. The goal of this approach is code simplicity. For best performance using native code and/or DirectX is recommended.
Mostra file Open project: xyzzer/WinRTXamlToolkit Class Usage Examples

Public Properties

Property Type Description
Bytes byte[]

Public Methods

Method Description
MaxDiff ( int i, int color ) : byte

Returns the maximum difference between any of the R/G/B/A components of a color at given index and the one passed as parameter.

PixelBufferInfo ( Windows.Storage.Streams.IBuffer pixelBuffer ) : System

Initializes a new instance of the PixelBufferInfo class.

UpdateFromBytes ( ) : void

Updates the associated pixel buffer from bytes.

this ( int i ) : int

Gets or sets the System.Int32 containing an ARGB format pixel at index i in the buffer.

To access a pixel at position x,y you need to get pixels[wb.PixelWidth * y + x].

Method Details

MaxDiff() public method

Returns the maximum difference between any of the R/G/B/A components of a color at given index and the one passed as parameter.
public MaxDiff ( int i, int color ) : byte
i int Pixel index
color int Color to compare to
return byte

PixelBufferInfo() public method

Initializes a new instance of the PixelBufferInfo class.
public PixelBufferInfo ( Windows.Storage.Streams.IBuffer pixelBuffer ) : System
pixelBuffer Windows.Storage.Streams.IBuffer The pixel buffer returned by WriteableBitmap.PixelBuffer.
return System

UpdateFromBytes() public method

Updates the associated pixel buffer from bytes.
public UpdateFromBytes ( ) : void
return void

this() public method

Gets or sets the System.Int32 containing an ARGB format pixel at index i in the buffer.
To access a pixel at position x,y you need to get pixels[wb.PixelWidth * y + x].
public this ( int i ) : int
i int The buffer index.
return int

Property Details

Bytes public_oe property

The bytes of the pixel stream.
public byte[] Bytes
return byte[]