ui::Matrix¶
Header: winui/render/PathGeometry.hpp.
An affine transform in row-vector layout: x' = x*m11 + y*m21 + dx, y' = x*m12 + y*m22 + dy. a * b applies a first.
The default-constructed matrix is the identity. Renderer::push_transform() takes one, and PathGeometry::transformed() runs a geometry's points through one.
Example:
// Scale by 2, then move 10 DIPs right: (5,5) lands at (20,10).
const ui::Matrix m = ui::Matrix::scale(2.0f, 2.0f) * ui::Matrix::translation(10.0f, 0.0f);
const ui::Point p = m.apply(ui::Point{5.0f, 5.0f});
const auto back = m.inverted(); // nullopt only for a zero scale
renderer.push_transform(m);
// ... draw ...
renderer.pop_transform();
m11¶
x scale (and rotation cosine).
m12¶
How much x feeds y' (rotation / skew).
m21¶
How much y feeds x' (rotation / skew).
m22¶
y scale (and rotation cosine).
dx¶
Horizontal translation, in DIPs.
dy¶
Vertical translation, in DIPs.
translation¶
A pure translation by (x, y) DIPs.
scale¶
A scale about the origin, sx horizontally and sy vertically.
rotation¶
A rotation by degrees clockwise (y down), about the origin.
apply¶
p run through the transform.
is_identity¶
True for the exact identity (no tolerance), which lets a caller skip a push_transform().
inverted¶
The inverse, or nullopt for a singular matrix (a zero scale), which maps every point onto a line and so has no way back. Pointer input hitting a scaled-to-nothing element gets this.
transform_bounds¶
The axis-aligned bounds of r once transformed.