#pragma once #include "../Painter.hpp" #include #include namespace cru::platform::graph::util { template void WithTransform(IPainter* painter, const Matrix& matrix, const Fn& action) { static_assert(std::is_invocable_v, "Action must can be be invoked with painter."); const auto old = painter->GetTransform(); painter->SetTransform(old * matrix); action(painter); painter->SetTransform(old); } } // namespace cru::platform::graph::util