diff options
author | crupest <crupest@outlook.com> | 2020-06-28 00:03:11 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-28 00:03:11 +0800 |
commit | 06d1d0442276a05b6caad6e3468f4afb1e8ee5df (patch) | |
tree | ebd46f0fb7343dc57bf947b7b5fffc139c3ddeac /include/cru/win/graph/direct/Brush.hpp | |
parent | e11be6caa9ef9b2b198ca61846e32f469627556e (diff) | |
download | cru-06d1d0442276a05b6caad6e3468f4afb1e8ee5df.tar.gz cru-06d1d0442276a05b6caad6e3468f4afb1e8ee5df.tar.bz2 cru-06d1d0442276a05b6caad6e3468f4afb1e8ee5df.zip |
...
Diffstat (limited to 'include/cru/win/graph/direct/Brush.hpp')
-rw-r--r-- | include/cru/win/graph/direct/Brush.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/cru/win/graph/direct/Brush.hpp b/include/cru/win/graph/direct/Brush.hpp new file mode 100644 index 00000000..df1debe3 --- /dev/null +++ b/include/cru/win/graph/direct/Brush.hpp @@ -0,0 +1,39 @@ +#pragma once +#include "ComResource.hpp" +#include "Resource.hpp" + +#include "cru/platform/graph/Brush.hpp" + +namespace cru::platform::graph::win::direct { +struct ID2DBrush : virtual IBrush { + virtual ID2D1Brush* GetD2DBrushInterface() const = 0; +}; + +class D2DSolidColorBrush : public DirectGraphResource, + public virtual ISolidColorBrush, + public virtual ID2DBrush, + public virtual IComResource<ID2D1SolidColorBrush> { + public: + explicit D2DSolidColorBrush(DirectGraphFactory* factory); + + CRU_DELETE_COPY(D2DSolidColorBrush) + CRU_DELETE_MOVE(D2DSolidColorBrush) + + ~D2DSolidColorBrush() override = default; + + public: + Color GetColor() override { return color_; } + void SetColor(const Color& color) override; + + ID2D1Brush* GetD2DBrushInterface() const override { return brush_.Get(); } + + ID2D1SolidColorBrush* GetComInterface() const override { + return brush_.Get(); + } + + private: + Color color_ = colors::black; + + Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> brush_; +}; +} // namespace cru::platform::graph::win::direct |