ITexture Interface
Definition
Section titled “Definition”Represents a texture provided by a game host.
public interface ITexture : IDisposableProperties
Section titled “Properties”ResourcePath
Section titled “ResourcePath”The file path to the texture.
string ResourcePath { get; }Height
Section titled “Height”The height of the texture.
int Height { get; }The width of the texture.
int Width { get; }Size of the texture. Generally, the count of pixels.
int Size { get; }Methods
Section titled “Methods”GetPixels()
Section titled “GetPixels()”Gets an array of colors.
Color[] GetPixels()Returns
Section titled “Returns”SadRogue.Primitives.Color[]
SetPixels(Color[])
Section titled “SetPixels(Color[])”Sets colors in the texture.
void SetPixels(Color[] colors)Parameters
Section titled “Parameters”colors SadRogue.Primitives.Color[]
The individual pixel colors to set.
SetPixels(ReadOnlySpan<Color>)
Section titled “SetPixels(ReadOnlySpan<Color>)”Sets colors in the texture.
void SetPixels(ReadOnlySpan<Color> colors)Parameters
Section titled “Parameters”colors ReadOnlySpan<Color>
The individual pixel colors to set.
SetPixel(Point, Color)
Section titled “SetPixel(Point, Color)”Sets a specific pixel in the texture to a color by x,y coordinate.
void SetPixel(Point position, Color color)Parameters
Section titled “Parameters”position SadRogue.Primitives.Point
The position of the pixel to set.
color SadRogue.Primitives.Color
The color to set.
SetPixel(int, Color)
Section titled “SetPixel(int, Color)”Sets a specific pixel in the texture to a color by index. Row-major ordered.
void SetPixel(int index, Color color)Parameters
Section titled “Parameters”index int
color SadRogue.Primitives.Color
GetPixel(Point)
Section titled “GetPixel(Point)”Gets a pixel in the texture by x,y coordinate.
Color GetPixel(Point position)Parameters
Section titled “Parameters”position SadRogue.Primitives.Point
The x,y coordinate of the pixel.
Returns
Section titled “Returns”SadRogue.Primitives.Color
The color of the pixel.
GetPixel(int)
Section titled “GetPixel(int)”Gets a pixel in the texture by index.
Color GetPixel(int index)Parameters
Section titled “Parameters”index int
The index of the pixel.
Returns
Section titled “Returns”SadRogue.Primitives.Color
The color of the pixel.
ToSurface(TextureConvertMode, int, int, TextureConvertBackgroundStyle, TextureConvertForegroundStyle, Color[]?, ICellSurface?)
Section titled “ToSurface(TextureConvertMode, int, int, TextureConvertBackgroundStyle, TextureConvertForegroundStyle, Color[]?, ICellSurface?)”Converts the texture into a cell surface based on the specified mode.
ICellSurface ToSurface(TextureConvertMode mode, int surfaceWidth, int surfaceHeight, TextureConvertBackgroundStyle backgroundStyle = TextureConvertBackgroundStyle.Pixel, TextureConvertForegroundStyle foregroundStyle = TextureConvertForegroundStyle.Block, Color[]? cachedColorArray = null, ICellSurface? cachedSurface = null)Parameters
Section titled “Parameters”mode TextureConvertMode
The mode used when converting the texture to a surface.
surfaceWidth int
How many cells wide the returned surface is.
surfaceHeight int
How many cells high the returned surface is.
backgroundStyle TextureConvertBackgroundStyle
The style to use when mode is Background.
foregroundStyle TextureConvertForegroundStyle
The style to use when mode is Foreground.
cachedColorArray SadRogue.Primitives.Color[]
When provided, this array is used for color data. It must match the texture’s expected GetPixels() bounds. Used with cachedColorArray.
cachedSurface ICellSurface
The cell surface to use instead of creating a new one. Used with cachedColorArray.
Returns
Section titled “Returns”ICellSurface
A new surface.