ui::TransformScope¶
Header: winui/render/Renderer.hpp.
Pushes a transform when it is made and pops it when it goes out of scope.
Example:
class ZoomedSwatch : public ui::Element
{
ui::Color color_ = ui::colors::Black;
void render_override(ui::Renderer& r, const ui::RenderContext&) const override
{
const ui::TransformScope zoom{r, 2.0f, ui::Point{bounds().x, bounds().y}};
r.fill_rounded_rect(ui::Rect{0.0f, 0.0f, 8.0f, 8.0f}, 0.0f, color_); // 16 DIPs at the top left
}
};
TransformScope¶
Transforms by transform (Renderer::push_transform()).
TransformScope¶
Scales by scale_x/scale_y about the origin, then translates by offset.
TransformScope¶
Scales uniformly by scale, then translates by offset.
~TransformScope¶
Pops the transform.