diff options
-rw-r--r-- | include/cru/osx/graphics/quartz/Font.hpp | 7 | ||||
-rw-r--r-- | src/osx/graphics/quartz/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/osx/graphics/quartz/Font.cpp | 5 | ||||
-rw-r--r-- | src/osx/graphics/quartz/Painter.cpp | 22 |
4 files changed, 36 insertions, 0 deletions
diff --git a/include/cru/osx/graphics/quartz/Font.hpp b/include/cru/osx/graphics/quartz/Font.hpp new file mode 100644 index 00000000..d3c50818 --- /dev/null +++ b/include/cru/osx/graphics/quartz/Font.hpp @@ -0,0 +1,7 @@ +#pragma once +#include "Resource.hpp" +#include "cru/platform/graphics/Font.hpp" + +namespace cru::platform::graphics::osx::quartz { + +} 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 |