aboutsummaryrefslogtreecommitdiff
path: root/include/cru/osx/graphics/quartz/Brush.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-08-22 21:15:33 +0800
committercrupest <crupest@outlook.com>2021-08-22 21:15:33 +0800
commit7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88 (patch)
tree387d0d8e18c581a7fcced157817f0b81c33c17e5 /include/cru/osx/graphics/quartz/Brush.hpp
parentc0616e3892e4f713bea7abd217191b8713a1d1bf (diff)
downloadcru-7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88.tar.gz
cru-7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88.tar.bz2
cru-7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88.zip
...
Diffstat (limited to 'include/cru/osx/graphics/quartz/Brush.hpp')
-rw-r--r--include/cru/osx/graphics/quartz/Brush.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/cru/osx/graphics/quartz/Brush.hpp b/include/cru/osx/graphics/quartz/Brush.hpp
new file mode 100644
index 00000000..fa0ef18c
--- /dev/null
+++ b/include/cru/osx/graphics/quartz/Brush.hpp
@@ -0,0 +1,38 @@
+#pragma once
+#include "Resource.hpp"
+#include "cru/common/Base.hpp"
+#include "cru/platform/graphics/Base.hpp"
+#include "cru/platform/graphics/Brush.hpp"
+
+#include <CoreGraphics/CoreGraphics.h>
+
+namespace cru::platform::graphics::osx::quartz {
+class QuartzBrush : public OsxQuartzResource, public virtual IBrush {
+ public:
+ QuartzBrush(IGraphFactory* graphics_factory)
+ : OsxQuartzResource(graphics_factory) {}
+ CRU_DELETE_COPY(QuartzBrush)
+ CRU_DELETE_MOVE(QuartzBrush)
+ ~QuartzBrush() override = default;
+};
+
+class QuartzSolidColorBrush : public QuartzBrush,
+ public virtual ISolidColorBrush {
+ public:
+ QuartzSolidColorBrush(IGraphFactory* graphics_factory, const Color& color);
+
+ CRU_DELETE_COPY(QuartzSolidColorBrush)
+ CRU_DELETE_MOVE(QuartzSolidColorBrush)
+
+ ~QuartzSolidColorBrush() override;
+
+ Color GetColor() override { return color_; }
+ void SetColor(const Color& color) override;
+
+ CGColorRef GetCGColorRef() const { return cg_color_; }
+
+ private:
+ Color color_;
+ CGColorRef cg_color_;
+};
+} // namespace cru::platform::graphics::osx::quartz