blob: 1f1c319f6577c81e6313e01e546caec9f19afb16 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  | 
#pragma once
#include "com_resource.hpp"
#include "direct_factory.hpp"
#include "platform_id.hpp"
#include "cru/platform/graph/brush.hpp"
namespace cru::platform::graph::win::direct {
struct ID2DBrush {
  virtual ~ID2DBrush() = default;
  virtual ID2D1Brush* GetD2DBrushInterface() const = 0;
};
class D2DSolidColorBrush : public SolidColorBrush,
                           public ID2DBrush,
                           public IComResource<ID2D1SolidColorBrush> {
 public:
  explicit D2DSolidColorBrush(IDirectFactory* factory);
  D2DSolidColorBrush(const D2DSolidColorBrush& other) = delete;
  D2DSolidColorBrush& operator=(const D2DSolidColorBrush& other) = delete;
  D2DSolidColorBrush(D2DSolidColorBrush&& other) = delete;
  D2DSolidColorBrush& operator=(D2DSolidColorBrush&& other) = delete;
  ~D2DSolidColorBrush() override = default;
  CRU_PLATFORMID_IMPLEMENT_DIRECT
 public:
  ID2D1Brush* GetD2DBrushInterface() const override { return brush_.Get(); }
  ID2D1SolidColorBrush* GetComInterface() const override {
    return brush_.Get();
  }
 protected:
  void OnSetColor(const Color& color) override;
 private:
  Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> brush_;
};
}  // namespace cru::platform::graph::win::direct
 
  |