diff options
| author | crupest <crupest@outlook.com> | 2019-04-01 18:08:58 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2019-04-01 18:08:58 +0800 |
| commit | de00126c6aeba189a50296df455dd516e21e4176 (patch) | |
| tree | 3d89a8a36a3603096d4371230c2d071f91e9e986 /include/cru/platform/painter_util.hpp | |
| parent | 055a3cde0cd19c896f3e498b774078654555c065 (diff) | |
| download | cru-de00126c6aeba189a50296df455dd516e21e4176.tar.gz cru-de00126c6aeba189a50296df455dd516e21e4176.tar.bz2 cru-de00126c6aeba189a50296df455dd516e21e4176.zip | |
...
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); +} +} |
