aboutsummaryrefslogtreecommitdiff
path: root/src/osx/graphics/quartz/Painter.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-09-02 00:10:31 +0800
committercrupest <crupest@outlook.com>2021-09-02 00:10:31 +0800
commit9e3d8fbd19ac93382a231a5eb8e7f8b389e6f6c2 (patch)
treeb95c6a30d2602e471b2f417d4c973f43ea09019a /src/osx/graphics/quartz/Painter.cpp
parent312bfa625dd02b59ceb5d1a9f9e5c5189446781b (diff)
downloadcru-9e3d8fbd19ac93382a231a5eb8e7f8b389e6f6c2.tar.gz
cru-9e3d8fbd19ac93382a231a5eb8e7f8b389e6f6c2.tar.bz2
cru-9e3d8fbd19ac93382a231a5eb8e7f8b389e6f6c2.zip
...
Diffstat (limited to 'src/osx/graphics/quartz/Painter.cpp')
-rw-r--r--src/osx/graphics/quartz/Painter.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/osx/graphics/quartz/Painter.cpp b/src/osx/graphics/quartz/Painter.cpp
index 42f6f1b7..be29310c 100644
--- a/src/osx/graphics/quartz/Painter.cpp
+++ b/src/osx/graphics/quartz/Painter.cpp
@@ -2,6 +2,7 @@
#include "cru/osx/graphics/quartz/Brush.hpp"
#include "cru/osx/graphics/quartz/Convert.hpp"
+#include "cru/osx/graphics/quartz/Geometry.hpp"
#include "cru/platform/Check.hpp"
namespace cru::platform::graphics::osx::quartz {
@@ -46,4 +47,25 @@ void QuartzCGContextPainter::FillRectangle(const Rect& rectangle,
CGContextFillRect(cg_context_, Convert(rectangle));
}
+void QuartzCGContextPainter::StrokeGeometry(IGeometry* geometry, IBrush* brush,
+ float width) {
+ QuartzGeometry* g = CheckPlatform<QuartzGeometry>(geometry, GetPlatformId());
+ QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId());
+
+ b->Select(cg_context_);
+ CGContextSetLineWidth(cg_context_, width);
+ CGContextBeginPath(cg_context_);
+ CGContextAddPath(cg_context_, g->GetCGPath());
+ CGContextStrokePath(cg_context_);
+}
+
+void QuartzCGContextPainter::FillGeometry(IGeometry* geometry, IBrush* brush) {
+ QuartzGeometry* g = CheckPlatform<QuartzGeometry>(geometry, GetPlatformId());
+ QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId());
+
+ b->Select(cg_context_);
+ CGContextBeginPath(cg_context_);
+ CGContextAddPath(cg_context_, g->GetCGPath());
+ CGContextFillPath(cg_context_);
+}
} // namespace cru::platform::graphics::osx::quartz