aboutsummaryrefslogtreecommitdiff
path: root/include/cru/osx/graphics/quartz/Painter.hpp
blob: 2d77ab3af97a62d8e345d7d7735c9698dac3c830 (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
#pragma once
#include "Resource.hpp"
#include "cru/platform/graphics/Painter.hpp"

#include <CoreGraphics/CoreGraphics.h>

namespace cru::platform::graphics::osx::quartz {
class QuartzCGContextPainter : public OsxQuartzResource,
                               public virtual IPainter {
 public:
  explicit QuartzCGContextPainter(CGContext* cg_context)
      : cg_context_(cg_context) {}

 public:
  Matrix GetTransform() override;
  void SetTransform(const Matrix& matrix) override;

  void Clear(const Color& color) override;

  void DrawLine(const Point& start, const Point& end, IBrush* brush,
                float width) override;
  void StrokeRectangle(const Rect& rectangle, IBrush* brush,
                       float width) override;
  void FillRectangle(const Rect& rectangle, IBrush* brush) override;

  void StrokeGeometry(IGeometry* geometry, IBrush* brush, float width) override;
  void FillGeometry(IGeometry* geometry, IBrush* brush) override;

  void DrawText(const Point& offset, ITextLayout* text_layout,
                IBrush* brush) override;

  void PushLayer(const Rect& bounds) override;

  void PopLayer() override;

  void EndDraw() override;

 private:
  CGContext* cg_context_;
};
}  // namespace cru::platform::graphics::osx::quartz