Class TextureData

TextureData class

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

public class TextureData : A3DObject

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
virtual Name { get; set; }Gets or sets the name.
PixelFormat { get; }The pixel’s format
Properties { get; }Gets the collection of all properties.
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
FindProperty(string)Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name)
GetProperty(string)Get the value of specified property
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
RemoveProperty(Property)Removes a dynamic property.
RemoveProperty(string)Remove the specified property identified by name
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
SetProperty(string, object)Sets the value of specified property
TransformPixelFormat(PixelFormat)Transform pixel’s layout to new pixel format.

See Also