Class Graphics
- Namespace
- SimulationFramework.Drawing
- Assembly
- SimulationFramework.dll
Provides graphical functionality to the application.
public static class Graphics
- Inheritance
-
Graphics
- Inherited Members
Properties
DefaultFont
The default simulation font.
public static IFont DefaultFont { get; }
Property Value
Methods
CreateTexture(int, int, Color[]?, TextureOptions)
Creates a new texture with the provided data.
public static ITexture CreateTexture(int width, int height, Color[]? colors, TextureOptions options = TextureOptions.None)
Parameters
width
intThe width of the texture.
height
intThe height of the texture.
colors
Color[]The initial colors of the texture. Must have exactly
width
*height
elements. If this value is null, the texture will be blank.options
TextureOptionsOptions that configure the allowed behaviors of the texture.
Returns
- ITexture
The newly created texture.
CreateTexture(int, int, TextureOptions)
Creates a new texture without any inital data.
public static ITexture CreateTexture(int width, int height, TextureOptions options = TextureOptions.None)
Parameters
width
intThe width of the texture, in pixels.
height
intThe height of the texture, in pixels.
options
TextureOptionsOptions that configure the allowed behaviors of the texture.
Returns
- ITexture
The newly created texture.
CreateTexture(int, int, ReadOnlySpan<Color>, TextureOptions)
Creates a new texture with the provided data.
public static ITexture CreateTexture(int width, int height, ReadOnlySpan<Color> colors, TextureOptions options = TextureOptions.None)
Parameters
width
intThe width of the texture.
height
intThe height of the texture.
colors
ReadOnlySpan<Color>The initial colors of the texture. Must have exactly
width
*height
elements. If this value is null, the texture will be blank.options
TextureOptionsOptions that configure the allowed behaviors of the texture.
Returns
- ITexture
The newly created texture.
GetOutputCanvas()
Gets window canvas for the current frame.
public static ICanvas GetOutputCanvas()
Returns
LoadFont(ReadOnlySpan<byte>)
Loads a font from encoded font file.
public static IFont LoadFont(ReadOnlySpan<byte> encodedData)
Parameters
encodedData
ReadOnlySpan<byte>The content of the font file.
Returns
- IFont
The loaded font.
LoadFont(string)
Loads a font from a file.
public static IFont LoadFont(string path)
Parameters
path
stringThe path to the font file.
Returns
- IFont
The loaded font.
LoadSystemFont(string)
Loads a pre-existing font from the operating system.
If the font is not present, this method will throw an exception.
public static IFont LoadSystemFont(string name)
Parameters
name
stringThe name of the font to load.
Returns
- IFont
The loaded font.
LoadTexture(byte[], TextureOptions)
Loads a texture from an encoded image.
public static ITexture LoadTexture(byte[] encodedData, TextureOptions options = TextureOptions.None)
Parameters
encodedData
byte[]The encoded image bytes.
options
TextureOptionsOptions that configure the allowed behaviors of the texture.
Returns
- ITexture
The texture loaded from the encoded image.
LoadTexture(ReadOnlySpan<byte>, TextureOptions)
Loads a texture from an encoded image.
public static ITexture LoadTexture(ReadOnlySpan<byte> encodedData, TextureOptions options = TextureOptions.None)
Parameters
encodedData
ReadOnlySpan<byte>The encoded image bytes.
options
TextureOptionsOptions that configure the allowed behaviors of the texture.
Returns
- ITexture
The texture loaded from the encoded image.
LoadTexture(string, TextureOptions)
Loads a texture from a file.
public static ITexture LoadTexture(string path, TextureOptions options = TextureOptions.None)
Parameters
path
stringThe path to the image file.
options
TextureOptionsOptions that configure the allowed behaviors of the texture.
Returns
- ITexture
The texture loaded from the file.
TryLoadSystemFont(string, out IFont?)
Attempts to load a pre-existing font from the operating system.
public static bool TryLoadSystemFont(string name, out IFont? font)
Parameters
name
stringThe name of the font to load.
font
IFontThe loaded font. Will be non-null if this method returns true.