Table of Contents

Class CanvasState

Namespace
SimulationFramework.Drawing
Assembly
SimulationFramework.dll

Provides access to state-specific data of an ICanvas.

public abstract class CanvasState
Inheritance
CanvasState
Inherited Members

Properties

Antialias

If the canvas should render using antialiasing.

public bool Antialias { get; }

Property Value

bool

ClipRegion

The clip region of the canvas, or null if clipping is disabled.

public Rectangle? ClipRegion { get; }

Property Value

Rectangle?

DrawMode

Gets or sets the drawing mode of the canvas.

The state for each value of DrawMode is stored independently. Setting this property will use the previous state for that DrawMode value.

public DrawMode DrawMode { get; }

Property Value

DrawMode

FillColor

The color of filled regions when DrawMode is Fill.

public Color FillColor { get; }

Property Value

Color

FillTexture

The texture used to fill when DrawMode is Textured, or null if none is set.

public ITexture? FillTexture { get; }

Property Value

ITexture

FillTextureTileModeX

The tiling mode of the fill texture on the X axis. This property's default value is Clamp.

public TileMode FillTextureTileModeX { get; }

Property Value

TileMode

FillTextureTileModeY

The tiling mode of the fill texture on the Y axis. This property's default value is Clamp.

public TileMode FillTextureTileModeY { get; }

Property Value

TileMode

FillTextureTransform

The transform applied to the fill texture. This property's default value is Identity.

public Matrix3x2 FillTextureTransform { get; }

Property Value

Matrix3x2

Font

The current font.

public IFont? Font { get; }

Property Value

IFont

FontSize

The font size when drawing text.

public float FontSize { get; }

Property Value

float

FontStyle

The font style whe drawing text.

public FontStyle FontStyle { get; }

Property Value

FontStyle

Gradient

The gradient used to fill regions when DrawMode is Gradient, or null if none is set.

public Gradient? Gradient { get; }

Property Value

Gradient

StrokeColor

The color of points and lines when DrawMode is Stroke.

public Color StrokeColor { get; }

Property Value

Color

StrokeWidth

The stroke width of the canvas. This value only has an effect on drawing when drawing lines or when DrawMode is Stroke.

public float StrokeWidth { get; }

Property Value

float

Transform

The canvas's current transformation matrix.

public Matrix3x2 Transform { get; }

Property Value

Matrix3x2

Methods

Initialize(CanvasState?)

Initializes this CanvasState instance, optionally based off another instance.

protected virtual void Initialize(CanvasState? other)

Parameters

other CanvasState

The CanvasState instance which this state should be initialized to match, or null if this state should be initialized to its default values.

Reapply()

Reapplies the state's settings.

protected void Reapply()

UpdateAntialias(bool)

When overridden in dervied classes, updates whether canvas state has antialiasing enabled.

protected virtual void UpdateAntialias(bool antialias)

Parameters

antialias bool

UpdateClipRegion(Rectangle?)

When overridden in dervied classes, updates the canvas state's clip region.

protected virtual void UpdateClipRegion(Rectangle? clipRegion)

Parameters

clipRegion Rectangle?

UpdateDrawMode(DrawMode)

When overridden in dervied classes, updates the canvas state's draw mode.

protected virtual void UpdateDrawMode(DrawMode drawMode)

Parameters

drawMode DrawMode

UpdateFillColor(Color)

When overridden in dervied classes, updates the canvas state's fill color.

protected virtual void UpdateFillColor(Color fillColor)

Parameters

fillColor Color

UpdateFillTexture(ITexture?, Matrix3x2, TileMode, TileMode)

When overridden in dervied classes, updates the canvas state's fill texture and any respective settings.

protected virtual void UpdateFillTexture(ITexture? texture, Matrix3x2 transform, TileMode tileModeX, TileMode tileModeY)

Parameters

texture ITexture
transform Matrix3x2
tileModeX TileMode
tileModeY TileMode

UpdateFont(IFont?)

When overridden in dervied classes, updates the canvas state's font.

protected virtual void UpdateFont(IFont? font)

Parameters

font IFont

UpdateFontSize(float)

Updates the canvas state's current font size.

protected virtual void UpdateFontSize(float fontSize)

Parameters

fontSize float

UpdateFontStyle(FontStyle)

When overridden in dervied classes, updates the canvas state's font style.

protected virtual void UpdateFontStyle(FontStyle style)

Parameters

style FontStyle

UpdateGradient(Gradient?)

When overridden in dervied classes, updates the canvas state's gradient.

protected virtual void UpdateGradient(Gradient? gradient)

Parameters

gradient Gradient

UpdateStrokeColor(Color)

When overridden in dervied classes, updates the canvas state's stroke color.

protected virtual void UpdateStrokeColor(Color strokeColor)

Parameters

strokeColor Color

UpdateStrokeWidth(float)

When overridden in dervied classes, updates the canvas state's stroke width.

protected virtual void UpdateStrokeWidth(float strokeWidth)

Parameters

strokeWidth float

UpdateTransform(Matrix3x2)

When overridden in dervied classes, updates the canvas state's transform.

protected virtual void UpdateTransform(Matrix3x2 transform)

Parameters

transform Matrix3x2