blob: 9b29ef59b24b35e95f65580cb3b86a119c50286c (
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
45
 | #pragma once
#include "Resource.h"
#include "cru/base/Base.h"
#include "cru/platform/graphics/Base.h"
#include "cru/platform/graphics/Brush.h"
#include <CoreGraphics/CoreGraphics.h>
namespace cru::platform::graphics::quartz {
class QuartzBrush : public OsxQuartzResource, public virtual IBrush {
 public:
  QuartzBrush(IGraphicsFactory* graphics_factory)
      : OsxQuartzResource(graphics_factory) {}
  CRU_DELETE_COPY(QuartzBrush)
  CRU_DELETE_MOVE(QuartzBrush)
  ~QuartzBrush() override = default;
 public:
  virtual void Select(CGContextRef context) = 0;
};
class QuartzSolidColorBrush : public QuartzBrush,
                              public virtual ISolidColorBrush {
 public:
  QuartzSolidColorBrush(IGraphicsFactory* graphics_factory, const Color& color);
  CRU_DELETE_COPY(QuartzSolidColorBrush)
  CRU_DELETE_MOVE(QuartzSolidColorBrush)
  ~QuartzSolidColorBrush() override;
  Color GetColor() override { return color_; }
  void SetColor(const Color& color) override;
  CGColorRef GetCGColorRef() const { return cg_color_; }
  void Select(CGContextRef context) override;
  String GetDebugString() override;
 private:
  Color color_;
  CGColorRef cg_color_;
};
}  // namespace cru::platform::graphics::quartz
 |