diff options
Diffstat (limited to 'include/cru/platform/painter_util.hpp')
| -rw-r--r-- | include/cru/platform/painter_util.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/cru/platform/painter_util.hpp b/include/cru/platform/painter_util.hpp new file mode 100644 index 00000000..fed0c487 --- /dev/null +++ b/include/cru/platform/painter_util.hpp @@ -0,0 +1,14 @@ +#pragma once +#include "painter.hpp" + +#include <functional> + +namespace cru::platform::util { +inline void WithTransform(Painter* painter, const Matrix& matrix, + const std::function<void(Painter*)>& action) { + const auto old = painter->GetTransform(); + painter->SetTransform(old * matrix); + action(painter); + painter->SetTransform(old); +} +} |
