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.
Afficher le fichier Open project: xyzzer/WinRTXamlToolkit Class Usage Examples

Méthodes publiques

Свойство Type Description
Bytes byte[]

Méthodes publiques

Méthode 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 méthode

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
Résultat byte

PixelBufferInfo() public méthode

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.
Résultat System

UpdateFromBytes() public méthode

Updates the associated pixel buffer from bytes.
public UpdateFromBytes ( ) : void
Résultat void

this() public méthode

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.
Résultat int

Property Details

Bytes public_oe property

The bytes of the pixel stream.
public byte[] Bytes
Résultat byte[]