aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/graph/direct/brush.hpp
blob: 9775b5c13f47dc57dffda266184b16c779ad795d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once
#include "com_resource.hpp"
#include "direct_factory.hpp"

#include "cru/platform/graph/brush.hpp"

namespace cru::platform::graph::win::direct {
class D2DSolidColorBrush : public SolidColorBrush,
                           public IComResource<ID2D1SolidColorBrush> {
 public:
  explicit D2DSolidColorBrush(IDirectFactory* factory);
  D2DSolidColorBrush(const D2DSolidColorBrush& other) = delete;
  D2DSolidColorBrush(D2DSolidColorBrush&& other) = delete;
  D2DSolidColorBrush& operator=(const D2DSolidColorBrush& other) = delete;
  D2DSolidColorBrush& operator=(D2DSolidColorBrush&& other) = delete;
  ~D2DSolidColorBrush() override = default;

  ID2D1SolidColorBrush* GetComInterface() override { return brush_.Get(); }

 protected:
  void OnSetColor(const Color& color) override;

 private:
  Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> brush_;
};
}  // namespace cru::platform::graph::win::direct