diff options
author | crupest <crupest@outlook.com> | 2021-08-22 21:15:33 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-08-22 21:15:33 +0800 |
commit | 7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88 (patch) | |
tree | 387d0d8e18c581a7fcced157817f0b81c33c17e5 /src/osx/graphics/quartz | |
parent | c0616e3892e4f713bea7abd217191b8713a1d1bf (diff) | |
download | cru-7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88.tar.gz cru-7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88.tar.bz2 cru-7fa6f61b1d7b253f749be73a4bfeee9a77cd2e88.zip |
...
Diffstat (limited to 'src/osx/graphics/quartz')
-rw-r--r-- | src/osx/graphics/quartz/Brush.cpp | 21 | ||||
-rw-r--r-- | src/osx/graphics/quartz/CMakeLists.txt | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/osx/graphics/quartz/Brush.cpp b/src/osx/graphics/quartz/Brush.cpp new file mode 100644 index 00000000..a930719c --- /dev/null +++ b/src/osx/graphics/quartz/Brush.cpp @@ -0,0 +1,21 @@ +#include "cru/osx/graphics/quartz/Brush.hpp" + +namespace cru::platform::graphics::osx::quartz { +QuartzSolidColorBrush::QuartzSolidColorBrush(IGraphFactory* graphics_factory, + const Color& color) + : QuartzBrush(graphics_factory), color_(color) { + cg_color_ = + CGColorCreateGenericRGB(color.GetFloatRed(), color.GetFloatGreen(), + color.GetFloatBlue(), color.GetFloatAlpha()); +} + +QuartzSolidColorBrush::~QuartzSolidColorBrush() { CGColorRelease(cg_color_); } + +void QuartzSolidColorBrush::SetColor(const Color& color) { + color_ = color; + CGColorRelease(cg_color_); + cg_color_ = + CGColorCreateGenericRGB(color.GetFloatRed(), color.GetFloatGreen(), + color.GetFloatBlue(), color.GetFloatAlpha()); +} +} // namespace cru::platform::graphics::osx::quartz diff --git a/src/osx/graphics/quartz/CMakeLists.txt b/src/osx/graphics/quartz/CMakeLists.txt index 2d66c3e7..fcbda648 100644 --- a/src/osx/graphics/quartz/CMakeLists.txt +++ b/src/osx/graphics/quartz/CMakeLists.txt @@ -1,12 +1,14 @@ set(CRU_OSX_GRAPHICS_NATIVE_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/osx/graphics/quartz) add_library(cru_osx_graphics_quartz SHARED + Brush.cpp Convert.cpp Factory.cpp Painter.cpp Resource.cpp ) 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}/Painter.hpp |