Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Paradox.Graphics.PixelBuffer Class Reference

An unmanaged buffer of pixels. More...

Public Member Functions

 PixelBuffer (int width, int height, PixelFormat format, int rowStride, int bufferStride, IntPtr dataPointer)
 Initializes a new instance of the PixelBuffer struct. More...
 
unsafe void CopyTo (PixelBuffer pixelBuffer)
 Copies this pixel buffer to a destination pixel buffer. More...
 
void Save (Stream imageStream, ImageFileType fileType)
 Saves this pixel buffer to a stream. More...
 
unsafe T GetPixel< T > (int x, int y)
 Gets the pixel value at a specified position. More...
 
unsafe void SetPixel< T > (int x, int y, T value)
 Gets the pixel value at a specified position. More...
 
T[] GetPixels< T > (int yOffset=0)
 Gets scanline pixels from the buffer. More...
 
void GetPixels< T > (T[] pixels, int yOffset=0)
 Gets scanline pixels from the buffer. More...
 
unsafe void GetPixels< T > (T[] pixels, int yOffset, int pixelIndex, int pixelCount)
 Gets scanline pixels from the buffer. More...
 
void SetPixels< T > (T[] sourcePixels, int yOffset=0)
 Sets scanline pixels to the buffer. More...
 
unsafe void SetPixels< T > (T[] sourcePixels, int yOffset, int pixelIndex, int pixelCount)
 Sets scanline pixels to the buffer. More...
 

Properties

int Width [get]
 Gets the width. More...
 
int Height [get]
 Gets the height. More...
 
PixelFormat Format [get]
 Gets the format. More...
 
int PixelSize [get]
 Gets the pixel size in bytes. More...
 
int RowStride [get]
 Gets the row stride in number of bytes. More...
 
int BufferStride [get]
 Gets the total size in bytes of this pixel buffer. More...
 
IntPtr DataPointer [get]
 Gets the pointer to the pixel buffer. More...
 

Detailed Description

An unmanaged buffer of pixels.

Definition at line 32 of file PixelBuffer.cs.

Constructor & Destructor Documentation

SiliconStudio.Paradox.Graphics.PixelBuffer.PixelBuffer ( int  width,
int  height,
PixelFormat  format,
int  rowStride,
int  bufferStride,
IntPtr  dataPointer 
)

Initializes a new instance of the PixelBuffer struct.

Parameters
widthThe width.
heightThe height.
formatThe format.
rowStrideThe row pitch.
bufferStrideThe slice pitch.
dataPointerThe pixels.

Definition at line 62 of file PixelBuffer.cs.

References DirectX.format, and DirectX.pixelSize.

Member Function Documentation

unsafe void SiliconStudio.Paradox.Graphics.PixelBuffer.CopyTo ( PixelBuffer  pixelBuffer)

Copies this pixel buffer to a destination pixel buffer.

Parameters
pixelBufferThe destination pixel buffer.

The destination pixel buffer must have exactly the same dimensions (width, height) and format than this instance. Destination buffer can have different row stride.

Definition at line 127 of file PixelBuffer.cs.

References SiliconStudio.Paradox.Graphics.PixelBuffer.BufferStride, SiliconStudio.Paradox.Graphics.PixelBuffer.DataPointer, SiliconStudio.Paradox.Graphics.PixelBuffer.Format, SiliconStudio.Paradox.Graphics.PixelBuffer.Height, SiliconStudio.Paradox.Graphics.PixelBuffer.RowStride, and SiliconStudio.Paradox.Graphics.PixelBuffer.Width.

unsafe T SiliconStudio.Paradox.Graphics.PixelBuffer.GetPixel< T > ( int  x,
int  y 
)

Gets the pixel value at a specified position.

Template Parameters
TType of the pixel data
Parameters
xThe x-coordinate.
yThe y-coordinate.
Returns
The pixel value.

Caution, this method doesn't check bounding.

Type Constraints
T :struct 

Definition at line 189 of file PixelBuffer.cs.

References DirectX.y.

T [] SiliconStudio.Paradox.Graphics.PixelBuffer.GetPixels< T > ( int  yOffset = 0)

Gets scanline pixels from the buffer.

Template Parameters
TType of the pixel data
Parameters
yOffsetThe y line offset.
Returns
Scanline pixels from the buffer
Exceptions
System.ArgumentExceptionIf the sizeof(T) is an invalid size

This method is working on a row basis. The yOffset is specifying the first row to get the pixels from.

Type Constraints
T :struct 

Definition at line 220 of file PixelBuffer.cs.

References DirectX.pixelSize.

void SiliconStudio.Paradox.Graphics.PixelBuffer.GetPixels< T > ( T[]  pixels,
int  yOffset = 0 
)

Gets scanline pixels from the buffer.

Template Parameters
TType of the pixel data
Parameters
pixelsAn allocated scanline pixel buffer
yOffsetThe y line offset.
Returns
Scanline pixels from the buffer
Exceptions
System.ArgumentExceptionIf the sizeof(T) is an invalid size

This method is working on a row basis. The yOffset is specifying the first row to get the pixels from.

Type Constraints
T :struct 

Definition at line 244 of file PixelBuffer.cs.

unsafe void SiliconStudio.Paradox.Graphics.PixelBuffer.GetPixels< T > ( T[]  pixels,
int  yOffset,
int  pixelIndex,
int  pixelCount 
)

Gets scanline pixels from the buffer.

Template Parameters
TType of the pixel data
Parameters
pixelsAn allocated scanline pixel buffer
yOffsetThe y line offset.
pixelIndexOffset into the destination pixels buffer.
pixelCountNumber of pixels to write into the destination pixels buffer.
Exceptions
System.ArgumentExceptionIf the sizeof(T) is an invalid size

This method is working on a row basis. The yOffset is specifying the first row to get the pixels from.

Type Constraints
T :struct 

Definition at line 262 of file PixelBuffer.cs.

void SiliconStudio.Paradox.Graphics.PixelBuffer.Save ( Stream  imageStream,
ImageFileType  fileType 
)

Saves this pixel buffer to a stream.

Parameters
imageStreamThe destination stream.
fileTypeSpecify the output format.

This method support the following format: dds, bmp, jpg, png, gif, tiff, wmp, tga.

Definition at line 164 of file PixelBuffer.cs.

References DirectX.format.

unsafe void SiliconStudio.Paradox.Graphics.PixelBuffer.SetPixel< T > ( int  x,
int  y,
value 
)

Gets the pixel value at a specified position.

Template Parameters
TType of the pixel data
Parameters
xThe x-coordinate.
yThe y-coordinate.
valueThe pixel value.

Caution, this method doesn't check bounding.

Type Constraints
T :struct 

Definition at line 204 of file PixelBuffer.cs.

References DirectX.y.

void SiliconStudio.Paradox.Graphics.PixelBuffer.SetPixels< T > ( T[]  sourcePixels,
int  yOffset = 0 
)

Sets scanline pixels to the buffer.

Template Parameters
TType of the pixel data
Parameters
sourcePixelsSource pixel buffer
yOffsetThe y line offset.
Exceptions
System.ArgumentExceptionIf the sizeof(T) is an invalid size

This method is working on a row basis. The yOffset is specifying the first row to get the pixels from.

Type Constraints
T :struct 

Definition at line 298 of file PixelBuffer.cs.

unsafe void SiliconStudio.Paradox.Graphics.PixelBuffer.SetPixels< T > ( T[]  sourcePixels,
int  yOffset,
int  pixelIndex,
int  pixelCount 
)

Sets scanline pixels to the buffer.

Template Parameters
TType of the pixel data
Parameters
sourcePixelsSource pixel buffer
yOffsetThe y line offset.
pixelIndexOffset into the source sourcePixels buffer.
pixelCountNumber of pixels to write into the source sourcePixels buffer.
Exceptions
System.ArgumentExceptionIf the sizeof(T) is an invalid size

This method is working on a row basis. The yOffset is specifying the first row to get the pixels from.

Type Constraints
T :struct 

Definition at line 316 of file PixelBuffer.cs.

Property Documentation

int SiliconStudio.Paradox.Graphics.PixelBuffer.BufferStride
get

Gets the total size in bytes of this pixel buffer.

The size in bytes of the pixel buffer.

Definition at line 111 of file PixelBuffer.cs.

Referenced by SiliconStudio.Paradox.Graphics.PixelBuffer.CopyTo().

IntPtr SiliconStudio.Paradox.Graphics.PixelBuffer.DataPointer
get

Gets the pointer to the pixel buffer.

The pointer to the pixel buffer.

Definition at line 117 of file PixelBuffer.cs.

Referenced by SiliconStudio.Paradox.Graphics.PixelBuffer.CopyTo().

PixelFormat SiliconStudio.Paradox.Graphics.PixelBuffer.Format
get

Gets the format.

The format.

Definition at line 93 of file PixelBuffer.cs.

Referenced by SiliconStudio.Paradox.Graphics.PixelBuffer.CopyTo().

int SiliconStudio.Paradox.Graphics.PixelBuffer.Height
get

Gets the height.

The height.

Definition at line 87 of file PixelBuffer.cs.

Referenced by SiliconStudio.Paradox.Graphics.PixelBuffer.CopyTo().

int SiliconStudio.Paradox.Graphics.PixelBuffer.PixelSize
get

Gets the pixel size in bytes.

The pixel size in bytes.

Definition at line 99 of file PixelBuffer.cs.

int SiliconStudio.Paradox.Graphics.PixelBuffer.RowStride
get

Gets the row stride in number of bytes.

The row stride in number of bytes.

Definition at line 105 of file PixelBuffer.cs.

Referenced by SiliconStudio.Paradox.Graphics.PixelBuffer.CopyTo().

int SiliconStudio.Paradox.Graphics.PixelBuffer.Width
get

Gets the width.

The width.

Definition at line 81 of file PixelBuffer.cs.

Referenced by SiliconStudio.Paradox.Graphics.PixelBuffer.CopyTo().


The documentation for this class was generated from the following file: