aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics/web_canvas/WebCanvasPainter.h
blob: cd885aa4e1cc8887c10930b9c958d06c10411a60 (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
#pragma once
#include "../Painter.h"
#include "WebCanvasResource.h"

#include <emscripten/val.h>
#include <optional>

namespace cru::platform::graphics::web_canvas {
class WebCanvasPainter : public WebCanvasResource, public virtual IPainter {
 public:
  WebCanvasPainter(WebCanvasGraphicsFactory* factory, emscripten::val context,
                   std::optional<Matrix> init_transform = std::nullopt);

  ~WebCanvasPainter() override;

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

 private:
  Matrix current_transform_;
  emscripten::val context_;
};
}  // namespace cru::platform::graphics::web_canvas