| 1 |
/* |
| 2 |
* Copyright 2017 Google Inc. |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef SkottieValue_DEFINED |
| 9 |
#define SkottieValue_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkColor.h" |
| 12 |
#include "include/core/SkM44.h" |
| 13 |
#include "include/core/SkPath.h" |
| 14 |
|
| 15 |
#include <initializer_list> |
| 16 |
#include <vector> |
| 17 |
|
| 18 |
namespace skjson { class Value; } |
| 19 |
|
| 20 |
namespace skottie { |
| 21 |
|
| 22 |
using ScalarValue = SkScalar; |
| 23 |
using Vec2Value = SkV2; |
| 24 |
|
| 25 |
class VectorValue : public std::vector<float> { |
| 26 |
public: |
| 27 |
VectorValue() = default; |
| 28 |
|
| 29 |
VectorValue(std::initializer_list<float> l) : INHERITED(l) {} |
| 30 |
|
| 31 |
operator SkV3() const; |
| 32 |
private: |
| 33 |
using INHERITED = std::vector<float>; |
| 34 |
}; |
| 35 |
|
| 36 |
class ColorValue final : public VectorValue { |
| 37 |
public: |
| 38 |
ColorValue() = default; |
| 39 |
|
| 40 |
ColorValue(std::initializer_list<float> l) : INHERITED(l) {} |
| 41 |
|
| 42 |
operator SkColor() const; |
| 43 |
operator SkColor4f() const; |
| 44 |
|
| 45 |
private: |
| 46 |
using INHERITED = VectorValue; |
| 47 |
}; |
| 48 |
|
| 49 |
class ShapeValue final : public std::vector<float> { |
| 50 |
public: |
| 51 |
operator SkPath() const; |
| 52 |
}; |
| 53 |
|
| 54 |
} // namespace skottie |
| 55 |
|
| 56 |
#endif // SkottieValue_DEFINED |