aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent312bfa625dd02b59ceb5d1a9f9e5c5189446781b (diff)
downloadcru-9e3d8fbd19ac93382a231a5eb8e7f8b389e6f6c2.tar.gz
cru-9e3d8fbd19ac93382a231a5eb8e7f8b389e6f6c2.tar.bz2
cru-9e3d8fbd19ac93382a231a5eb8e7f8b389e6f6c2.zip
...
Diffstat (limited to 'src')
-rw-r--r--src/osx/graphics/quartz/CMakeLists.txt2
-rw-r--r--src/osx/graphics/quartz/Font.cpp5
-rw-r--r--src/osx/graphics/quartz/Painter.cpp22
3 files changed, 29 insertions, 0 deletions
diff --git a/src/osx/graphics/quartz/CMakeLists.txt b/src/osx/graphics/quartz/CMakeLists.txt
index 6c978b18..d58b7ecc 100644
--- a/src/osx/graphics/quartz/CMakeLists.txt
+++ b/src/osx/graphics/quartz/CMakeLists.txt
@@ -4,6 +4,7 @@ add_library(cru_osx_graphics_quartz SHARED
Brush.cpp
Convert.cpp
Factory.cpp
+ Font.cpp
Geometry.cpp
Painter.cpp
Resource.cpp
@@ -12,6 +13,7 @@ target_sources(cru_osx_graphics_quartz PUBLIC
${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Brush.hpp
${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Convert.hpp
${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Factory.hpp
+ ${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Font.hpp
${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Geometry.hpp
${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Painter.hpp
${CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR}/Resource.hpp
diff --git a/src/osx/graphics/quartz/Font.cpp b/src/osx/graphics/quartz/Font.cpp
new file mode 100644
index 00000000..15ef9b21
--- /dev/null
+++ b/src/osx/graphics/quartz/Font.cpp
@@ -0,0 +1,5 @@
+#include "cru/osx/graphics/quartz/Font.hpp"
+
+namespace cru::platform::graphics::osx::quartz {
+
+}
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