Skip to content

MonoGame_TextureExtensions Class

Extensions for the Microsoft.Xna.Framework.Graphics.Texture2D type.

C#
public static class MonoGame_TextureExtensions

Inheritance object

Converts a texture’s pixels to a ICellSurface.

C#
public static ICellSurface ToSurface(this Texture2D image, IFont font, Point fontSize, bool blockMode = false)

image Microsoft.Xna.Framework.Graphics.Texture2D
The texture to process.

font IFont
The font used with the cell surface.

fontSize SadRogue.Primitives.Point
The size of the font.

blockMode bool
true to indicate the result should use block characters instead of text characters.

ICellSurface

ToSurface(Texture2D, ICellSurface, Color[], IFont, Point, bool)

Section titled “ToSurface(Texture2D, ICellSurface, Color[], IFont, Point, bool)”

Converts a texture’s pixels to the specified ICellSurface.

C#
public static void ToSurface(this Texture2D image, ICellSurface surface, Color[] cachedColorArray, IFont font, Point fontSize, bool blockMode = false)

image Microsoft.Xna.Framework.Graphics.Texture2D
The texture to process.

surface ICellSurface
The surface to draw on.

cachedColorArray Microsoft.Xna.Framework.Color[]
A buffer holding the color information from the texture.

font IFont
The font used with the cell surface.

fontSize SadRogue.Primitives.Point
The size of the font.

blockMode bool
true to indicate the result should use block characters instead of text characters.

Saves a texture to a png file.

C#
public static void Save(this Texture2D target, string path)

target Microsoft.Xna.Framework.Graphics.Texture2D
The texture.

path string
The path to a png file.