aboutsummaryrefslogtreecommitdiff
path: root/include/cru/osx
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/osx')
-rw-r--r--include/cru/osx/Exception.hpp10
-rw-r--r--include/cru/osx/Resource.hpp13
-rw-r--r--include/cru/osx/graphics/quartz/Factory.hpp (renamed from include/cru/osx/graphics/native/Factory.hpp)0
-rw-r--r--include/cru/osx/graphics/quartz/Painter.hpp41
-rw-r--r--include/cru/osx/graphics/quartz/Resource.hpp14
5 files changed, 73 insertions, 5 deletions
diff --git a/include/cru/osx/Exception.hpp b/include/cru/osx/Exception.hpp
index 34c4a06c..5d057c65 100644
--- a/include/cru/osx/Exception.hpp
+++ b/include/cru/osx/Exception.hpp
@@ -2,8 +2,8 @@
#include "cru/platform/Exception.hpp"
namespace cru::platform::osx {
- class OsxException : PlatformException {
- public:
- using PlatformException::PlatformException;
- };
-}
+class OsxException : public PlatformException {
+ public:
+ using PlatformException::PlatformException;
+};
+} // namespace cru::platform::osx
diff --git a/include/cru/osx/Resource.hpp b/include/cru/osx/Resource.hpp
new file mode 100644
index 00000000..b1f673f8
--- /dev/null
+++ b/include/cru/osx/Resource.hpp
@@ -0,0 +1,13 @@
+#pragma once
+#include "cru/platform/Resource.hpp"
+
+namespace cru::platform::osx {
+class OsxResource : public Object, public virtual IPlatformResource {
+ public:
+ CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(OsxResource)
+ CRU_DELETE_COPY(OsxResource)
+ CRU_DELETE_MOVE(OsxResource)
+
+ String GetPlatformId() const override { return u"OSX"; }
+};
+} // namespace cru::platform::osx
diff --git a/include/cru/osx/graphics/native/Factory.hpp b/include/cru/osx/graphics/quartz/Factory.hpp
index 6f70f09b..6f70f09b 100644
--- a/include/cru/osx/graphics/native/Factory.hpp
+++ b/include/cru/osx/graphics/quartz/Factory.hpp
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
diff --git a/include/cru/osx/graphics/quartz/Resource.hpp b/include/cru/osx/graphics/quartz/Resource.hpp
new file mode 100644
index 00000000..b302c84c
--- /dev/null
+++ b/include/cru/osx/graphics/quartz/Resource.hpp
@@ -0,0 +1,14 @@
+#pragma once
+#include "cru/osx/Resource.hpp"
+
+namespace cru::platform::graphics::osx::quartz {
+class OsxQuartzResource : public platform::osx::OsxResource {
+ public:
+ CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(OsxQuartzResource)
+ CRU_DELETE_COPY(OsxQuartzResource)
+ CRU_DELETE_MOVE(OsxQuartzResource)
+
+ public:
+ String GetPlatformId() const override { return u"OSX Quartz"; }
+};
+} // namespace cru::platform::graphics::osx::quartz