aboutsummaryrefslogtreecommitdiff
path: root/include/cru/osx/graphics/quartz/Painter.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-08-20 22:10:45 +0800
committercrupest <crupest@outlook.com>2021-08-20 22:10:45 +0800
commite2e8ba559b0e7a797c083684b382ac4cbb2fdd5f (patch)
tree9b9e61142c490c53a5d7b3bba2c62ee6281a87db /include/cru/osx/graphics/quartz/Painter.hpp
parentbcb879240f96764b8f17da2878fc0784c51b6054 (diff)
downloadcru-e2e8ba559b0e7a797c083684b382ac4cbb2fdd5f.tar.gz
cru-e2e8ba559b0e7a797c083684b382ac4cbb2fdd5f.tar.bz2
cru-e2e8ba559b0e7a797c083684b382ac4cbb2fdd5f.zip
...
Diffstat (limited to 'include/cru/osx/graphics/quartz/Painter.hpp')
-rw-r--r--include/cru/osx/graphics/quartz/Painter.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/cru/osx/graphics/quartz/Painter.hpp b/include/cru/osx/graphics/quartz/Painter.hpp
new file mode 100644
index 00000000..2d77ab3a
--- /dev/null
+++ b/include/cru/osx/graphics/quartz/Painter.hpp
@@ -0,0 +1,41 @@
+#pragma once
+#include "Resource.hpp"
+#include "cru/platform/graphics/Painter.hpp"
+
+#include <CoreGraphics/CoreGraphics.h>
+
+namespace cru::platform::graphics::osx::quartz {
+class QuartzCGContextPainter : public OsxQuartzResource,
+ public virtual IPainter {
+ public:
+ explicit QuartzCGContextPainter(CGContext* cg_context)
+ : cg_context_(cg_context) {}
+
+ public:
+ Matrix GetTransform() override;
+ void SetTransform(const Matrix& matrix) override;
+
+ void Clear(const Color& color) override;
+
+ void DrawLine(const Point& start, const Point& end, IBrush* brush,
+ float width) override;
+ void StrokeRectangle(const Rect& rectangle, IBrush* brush,
+ float width) override;
+ void FillRectangle(const Rect& rectangle, IBrush* brush) override;
+
+ void StrokeGeometry(IGeometry* geometry, IBrush* brush, float width) override;
+ void FillGeometry(IGeometry* geometry, IBrush* brush) override;
+
+ void DrawText(const Point& offset, ITextLayout* text_layout,
+ IBrush* brush) override;
+
+ void PushLayer(const Rect& bounds) override;
+
+ void PopLayer() override;
+
+ void EndDraw() override;
+
+ private:
+ CGContext* cg_context_;
+};
+} // namespace cru::platform::graphics::osx::quartz