diff options
author | crupest <crupest@outlook.com> | 2021-08-22 22:19:59 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-08-22 22:19:59 +0800 |
commit | 100c2ae5cd7b815dc9accca0fa9ceaca2f5d1020 (patch) | |
tree | 35af05c94af8ff616e83f199cef971811ff1ecf8 /src/osx/graphics/quartz | |
parent | 7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88 (diff) | |
download | cru-100c2ae5cd7b815dc9accca0fa9ceaca2f5d1020.tar.gz cru-100c2ae5cd7b815dc9accca0fa9ceaca2f5d1020.tar.bz2 cru-100c2ae5cd7b815dc9accca0fa9ceaca2f5d1020.zip |
...
Diffstat (limited to 'src/osx/graphics/quartz')
-rw-r--r-- | src/osx/graphics/quartz/Brush.cpp | 9 | ||||
-rw-r--r-- | src/osx/graphics/quartz/Factory.cpp | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/osx/graphics/quartz/Brush.cpp b/src/osx/graphics/quartz/Brush.cpp index a930719c..6e4893b1 100644 --- a/src/osx/graphics/quartz/Brush.cpp +++ b/src/osx/graphics/quartz/Brush.cpp @@ -18,4 +18,13 @@ void QuartzSolidColorBrush::SetColor(const Color& color) { CGColorCreateGenericRGB(color.GetFloatRed(), color.GetFloatGreen(), color.GetFloatBlue(), color.GetFloatAlpha()); } + +void QuartzSolidColorBrush::Select(CGContextRef context) { + CGContextSaveGState(context); + + CGContextSetStrokeColorWithColor(context, cg_color_); + CGContextSetFillColorWithColor(context, cg_color_); + + CGContextRestoreGState(context); +} } // namespace cru::platform::graphics::osx::quartz diff --git a/src/osx/graphics/quartz/Factory.cpp b/src/osx/graphics/quartz/Factory.cpp index f9b792f2..72dd96c7 100644 --- a/src/osx/graphics/quartz/Factory.cpp +++ b/src/osx/graphics/quartz/Factory.cpp @@ -1 +1,12 @@ #include "cru/osx/graphics/quartz/Factory.hpp" + +#include "cru/osx/graphics/quartz/Brush.hpp" + +#include <memory> + +namespace cru::platform::graphics::osx::quartz { +std::unique_ptr<ISolidColorBrush> +QuartzGraphicsFactory::CreateSolidColorBrush() { + return std::make_unique<QuartzSolidColorBrush>(this, colors::black); +} +} // namespace cru::platform::graphics::osx::quartz |