Table of Contents

Class Decoration

Namespace
BSGameLib.UI.Controls
Assembly
BSGameLib.UI.dll

A purely visual mark pinned to a corner or edge of a view - corner flourishes, framing rules, a watermark.

public class Decoration
Inheritance
Decoration
Inherited Members

Remarks

Deliberately not a UIElement: a decoration never enters the layout tree's measure/arrange pass, never reserves flow space, and is never hit-tested or focusable. That's the whole reason it exists - the layout system is Stack/Dock/Grid only, and there's no way to ask any of them for a zero-footprint mark in a corner. Docking one would reserve a strip along an entire edge.

Properties

Anchor

The point of the view the decoration is pinned to. Offset is measured inward from it.

public DecorationAnchor Anchor { get; set; }

Property Value

DecorationAnchor

BorderColor

The colour of the border, or null for none.

public Color? BorderColor { get; set; }

Property Value

Color?

BorderThickness

The border's width in pixels. A border is drawn only when this is above 0 and BorderColor is set.

public int BorderThickness { get; set; }

Property Value

int

FillColor

A flat colour behind the decoration, or null for none. FillGradient takes its place when both are set.

public Color? FillColor { get; set; }

Property Value

Color?

FillGradient

A gradient fill, drawn in place of FillColor when both are set. Null for none.

public Gradient FillGradient { get; set; }

Property Value

Gradient

Layer

Whether this is painted under the control tree or over it.

public DecorationLayer Layer { get; set; }

Property Value

DecorationLayer

Offset

Distance inward from Anchor. Ignored on a centered axis.

public Vector2 Offset { get; set; }

Property Value

Vector2

Size

The size of the decoration, in pixels. Ignored when Stretch is set.

public Vector2 Size { get; set; }

Property Value

Vector2

Stretch

Covers the whole view, whatever its size, ignoring Anchor, Offset and Size - for a page background or a scrim. The UI lays out in the window's real pixels, so a fixed "big enough" size is only big enough for some windows.

public bool Stretch { get; set; }

Property Value

bool

Texture

A texture drawn over the fill and border, or null for none.

public ITexture Texture { get; set; }

Property Value

ITexture

TextureColor

The tint applied to Texture. White leaves it as it is.

public Color TextureColor { get; set; }

Property Value

Color

Methods

ResolveBounds(float, float)

Works out where the decoration is drawn in a view of the given size, in pixels.

public Rectangle ResolveBounds(float viewWidth, float viewHeight)

Parameters

viewWidth float
viewHeight float

Returns

Rectangle