Class TextureData

TextureData class

This class contains the raw data and format definition of a texture.

public class TextureData

Constructors

NameDescription
TextureData()Constructor of TextureData
TextureData(int, int, PixelFormat)Constructs a new TextureData and allocate pixel data.
TextureData(int, int, int, int, PixelFormat, byte[])Constructor of TextureData

Properties

NameDescription
BytesPerPixel { get; }Number of bytes of a pixel
Data { get; }Raw bytes of pixel data
Height { get; }Number of vertical pixels
PixelFormat { get; }The pixel’s format
Stride { get; }Number of bytes of a scanline.
Width { get; }Number of horizontal pixels

Methods

NameDescription
static FromFile(string)Load a texture from file
static FromStream(Stream)Load a texture from stream
MapPixels(PixelMapMode)Map all pixels for read/write
MapPixels(PixelMapMode, PixelFormat)Map all pixels for read/write in given pixel format
MapPixels(Rect, PixelMapMode, PixelFormat)Map pixels addressed by rect for reading/writing in given pixel format
Save(string)Save texture data into image file
Save(Stream, string)Save texture data into specified image format
Save(string, string)Save texture data into image file
TransformPixelFormat(PixelFormat)Transform pixel’s layout to new pixel format.

See Also