ui::ClipScope¶
Header: winui/render/Renderer.hpp.
Pushes a clip when it is made and pops it when it goes out of scope, so an early return cannot leave the clip pushed.
Example:
class Caption : public ui::Element
{
std::string label_ = "A caption longer than its box";
void render_override(ui::Renderer& r, const ui::RenderContext& context) const override
{
const ui::Theme& theme = context.theme;
const ui::ClipScope clip{r, bounds()};
r.draw_text(label_, bounds(), theme.colors().text, theme.type.body); // clipped to bounds()
}
};
ClipScope¶
Clips to bounds (Renderer::push_clip()).
ClipScope¶
Clips to an ellipse (Renderer::push_clip_ellipse()).
ClipScope¶
Clips to a rect with rounded corners (Renderer::push_clip_rounded_rect()).
~ClipScope¶
Pops the clip.