Placement
public readonly struct Placement
Where one camera's frame sits in view space.
A 3x3 affine transform: zoom, rotation, and where the frame's centre lands. A value, not a handle; copy it freely.
Build one with Placement.Identity or Placement.Centred(…). The default Placement value is not usable: the underlying struct is versioned and every entry point validates its size, so a zeroed one is refused. Both factories initialise it through the ABI, and this type has no public constructor for that reason.
Placement: properties
public bool HasShear { get; }
Whether the transform shears.
A placement built by this type never does; one read back out of a canvas somebody else composed may.
public bool IsIdentity { get; }
Whether this placement moves nothing.
public float[] Matrix { get; }
The nine coefficients of the transform, row by row.
public float RotationDeg { get; }
Rotation in degrees, anticlockwise.
public float Zoom { get; }
Output pixels per camera pixel.
Placement: methods
public static Placement Centred(uint frameWidth, uint frameHeight, Vector2 at = default, float zoom = 1, float rotationDeg = 0)
A frame centred on at, zoomed and rotated about itself.
frameWidth: The camera's width in pixels.frameHeight: The camera's height in pixels.at: Where the frame's centre lands.zoom: 1 is one output pixel per camera pixel.rotationDeg: Degrees, anticlockwise.
public Vector2 FrameCentre(uint frameWidth, uint frameHeight)
Where this frame's centre lands.
public static Placement Identity()
A placement that moves nothing.
public float[]? Inverse()
The inverse transform's nine coefficients, or null.
null when the transform cannot be inverted: a zero zoom, or a matrix collapsed to a line. The ABI reports that through a flag beside the matrix and documents it as "a state, not a failure", so this is a null rather than an exception and rather than nine numbers nobody should use.
public Placement Panned(Vector2 delta)
This placement shifted by delta.
Needs no frame size: a pan is a translation in view space and does not depend on how big the camera's picture is.
public Placement WithFrameCentre(Vector2 at, uint frameWidth, uint frameHeight)
This placement with the frame's centre moved to at.
public Placement WithRotationDeg(float degrees, uint frameWidth, uint frameHeight)
This placement with the rotation set, keeping the frame's centre.
public Placement WithZoom(float zoom, uint frameWidth, uint frameHeight)
This placement with the zoom set, keeping the frame's centre.
Returns a new value rather than mutating: a Placement is a readonly struct, so an assignment is how it changes.