abstract class Tinman.Engine.Drawing.Visual

Derived from

VersionedBase abstract

Abstract base class for IVisual implementations.

Public / Constructors


public static method Shape → (3)

shape in : IShape

The shape to wrap.

factory in : IShapeRasterizerFactory<ColorBuffer>

The shape rasterizer factory to use.

bounds opt : Box2D = default(Box2D)

The shape bounds to rasterize. If empty, IShape.VisibleBounds will be used. In either case, Box2D.TopLeft will be mapped to (0,0) in visual units.

returns → IVisual

The IVisual object that wraps shape in.

Creates a new instance of IVisual that wraps a IShape.

Public / Methods


public static method ComputeAlignedBounds → (5)

visualBounds in : Box2F

The visual bounds to align.

resolution in : float32

The resolution to use, in visual units per pixel.

visualBoundsAligned out : Box2F

Output of the aligned visual bounds. Will always fully contain visualBounds in. This value will be written after visualBounds in has been fully read.

pixelOffset out : Vec2F

Offset from the top-left corner of the enlarged pixel bounds to the original pixel bounds.

pixelSize out : Vec2I

Output of the size of the enlarged pixel bounds.

Computes the pixel alignment of the given visualBounds in when using the given resolution in.

First, the resolution in is used to convert visualBounds in to pixel coordinates, which will usually have non-integral value. Then, the pixel bounds are enlarged, so that top-left and bottom-right corners align with the respective pixel corner, which makes pixel coordinate values integral. Finally, the enlarged pixel bounds are scaled back to visual units, which yields the aligned visual bounds.


public static method ComputeTransform → (2)

visualBounds in : Box2F

The bounds in visual units that get rasterized into the given pixelBounds in.

pixelBounds in : Box2I

The bounds in the pixel buffer that holds the rasterization result of the given visualBounds in.

returns → Mat3F

The affine 2D transformation matrix that converts visual units to pixels.

Computes the transformation matrix that converts visual units to pixel coordinates.