aboutsummaryrefslogtreecommitdiff
path: root/src/platform/graphics/web_canvas/Brush.cpp
blob: b86eb6a579d71fbc2cfe0ea54c8e2776e5c40734 (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
#include "cru/platform/graphics/web_canvas/WebCanvasBrush.h"
#include "cru/platform/graphics/web_canvas/WebCanvasGraphicsFactory.h"
#include "cru/platform/graphics/web_canvas/WebCanvasResource.h"

namespace cru::platform::graphics::web_canvas {
WebCanvasBrush::WebCanvasBrush(WebCanvasGraphicsFactory* factory)
    : WebCanvasResource(factory) {}

WebCanvasBrush::~WebCanvasBrush() {}

WebCanvasSolidColorBrush::WebCanvasSolidColorBrush(
    WebCanvasGraphicsFactory* factory, const Color& color)
    : WebCanvasBrush(factory), color_(color) {}

Color WebCanvasSolidColorBrush::GetColor() { return color_; }

void WebCanvasSolidColorBrush::SetColor(const Color& color) { color_ = color; }

String WebCanvasSolidColorBrush::GetCssColor() const {
  return color_.ToString();
}

emscripten::val WebCanvasSolidColorBrush::GetStyle() {
  return emscripten::val::u16string(color_.ToString().c_str());
}

}  // namespace cru::platform::graphics::web_canvas