Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
skottie Namespace Reference

Namespaces

namespace  internal
 

Classes

class  Animation
 
class  ColorValue
 
class  ExpressionEvaluator
 
class  ExpressionManager
 
class  ExternalLayer
 
class  GlyphDecorator
 
class  Logger
 
class  MarkerObserver
 
class  PrecompInterceptor
 
class  PropertyHandle
 
class  PropertyObserver
 
class  Shaper
 
class  ShapeValue
 
class  SlotManager
 
struct  TextPropertyValue
 
struct  TransformPropertyValue
 
class  VectorValue
 

Typedefs

using ImageAsset = skresources::ImageAsset
 
using ResourceProvider = skresources::ResourceProvider
 
using ColorPropertyValue = SkColor
 
using OpacityPropertyValue = float
 
using ColorPropertyHandle = PropertyHandle< ColorPropertyValue, sksg::Color >
 
using OpacityPropertyHandle = PropertyHandle< OpacityPropertyValue, sksg::OpacityEffect >
 
using TextPropertyHandle = PropertyHandle< TextPropertyValue, internal::TextAdapter >
 
using TransformPropertyHandle = PropertyHandle< TransformPropertyValue, internal::TransformAdapter2D >
 
using ScalarValue = SkScalar
 
using Vec2Value = SkV2
 
typedef TextPropertyValue TextValue
 

Enumerations

enum class  TextPaintOrder : uint8_t { kFillStroke , kStrokeFill }
 
enum  ShapeEncodingInfo : size_t {
  kX_Index = 0 , kY_Index = 1 , kInX_Index = 2 , kInY_Index = 3 ,
  kOutX_Index = 4 , kOutY_Index = 5 , kFloatsPerVertex = 6
}
 

Functions

static size_t shape_encoding_len (size_t vertex_count)
 
static const skjson::ObjectValueshape_root (const skjson::Value &jv)
 
static bool parse_encoding_len (const skjson::Value &jv, size_t *len)
 
static bool parse_encoding_data (const skjson::Value &jv, size_t data_len, float data[])
 
static bool parse_array (const skjson::ArrayValue *ja, float *a, size_t count)
 
template<>
bool Parse< SkScalar > (const Value &v, SkScalar *s)
 
template<>
bool Parse< bool > (const Value &v, bool *b)
 
template<typename T >
bool ParseIntegral (const Value &v, T *result)
 
template<>
bool Parse< int > (const Value &v, int *i)
 
template<>
bool Parse< size_t > (const Value &v, size_t *sz)
 
template<>
bool Parse< SkString > (const Value &v, SkString *s)
 
template<>
bool Parse< SkV2 > (const Value &v, SkV2 *v2)
 
template<>
bool Parse< SkPoint > (const Value &v, SkPoint *pt)
 
template<>
bool Parse< VectorValue > (const Value &v, VectorValue *vec)
 
const skjson::StringValueParseSlotID (const skjson::ObjectValue *jobj)
 
template<typename T >
bool Parse (const skjson::Value &, T *)
 
template<typename T >
T ParseDefault (const skjson::Value &v, const T &defaultValue)
 

Typedef Documentation

◆ ColorPropertyHandle

Definition at line 152 of file SkottieProperty.h.

◆ ColorPropertyValue

Definition at line 43 of file SkottieProperty.h.

◆ ImageAsset

Definition at line 45 of file Skottie.h.

◆ OpacityPropertyHandle

Definition at line 154 of file SkottieProperty.h.

◆ OpacityPropertyValue

using skottie::OpacityPropertyValue = typedef float

Definition at line 44 of file SkottieProperty.h.

◆ ResourceProvider

Definition at line 46 of file Skottie.h.

◆ ScalarValue

using skottie::ScalarValue = typedef SkScalar

Definition at line 22 of file SkottieValue.h.

◆ TextPropertyHandle

Definition at line 156 of file SkottieProperty.h.

◆ TextValue

Definition at line 16 of file TextValue.h.

◆ TransformPropertyHandle

Definition at line 158 of file SkottieProperty.h.

◆ Vec2Value

using skottie::Vec2Value = typedef SkV2

Definition at line 23 of file SkottieValue.h.

Enumeration Type Documentation

◆ ShapeEncodingInfo

Enumerator
kX_Index 
kY_Index 
kInX_Index 
kInY_Index 
kOutX_Index 
kOutY_Index 
kFloatsPerVertex 

Definition at line 38 of file ShapeKeyframeAnimator.cpp.

◆ TextPaintOrder

enum class skottie::TextPaintOrder : uint8_t
strong
Enumerator
kFillStroke 
kStrokeFill 

Definition at line 46 of file SkottieProperty.h.

Function Documentation

◆ Parse()

template<typename T >
bool skottie::Parse ( const skjson::Value ,
T  
)

◆ Parse< bool >()

template<>
bool skottie::Parse< bool > ( const Value v,
bool *  b 
)

Definition at line 43 of file SkottieJson.cpp.

43 {
44 switch(v.getType()) {
45 case Value::Type::kNumber:
46 *b = SkToBool(*v.as<NumberValue>());
47 return true;
48 case Value::Type::kBool:
49 *b = *v.as<BoolValue>();
50 return true;
51 default:
52 break;
53 }
54
55 return false;
56}
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
const T & as() const
Definition SkJSON.h:85
Type getType() const
Definition SkJSON.h:371
static bool b

◆ Parse< int >()

template<>
bool skottie::Parse< int > ( const Value v,
int i 
)

Definition at line 75 of file SkottieJson.cpp.

75 {
76 return ParseIntegral(v, i);
77}
bool ParseIntegral(const Value &v, T *result)

◆ Parse< size_t >()

template<>
bool skottie::Parse< size_t > ( const Value v,
size_t *  sz 
)

Definition at line 80 of file SkottieJson.cpp.

80 {
81 return ParseIntegral(v, sz);
82}

◆ Parse< SkPoint >()

template<>
bool skottie::Parse< SkPoint > ( const Value v,
SkPoint pt 
)

Definition at line 107 of file SkottieJson.cpp.

107 {
108 if (!v.is<ObjectValue>())
109 return false;
110 const auto& ov = v.as<ObjectValue>();
111
112 return Parse<SkScalar>(ov["x"], &pt->fX)
113 && Parse<SkScalar>(ov["y"], &pt->fY);
114}
bool is() const
Definition SkJSON.h:77
float fX
x-axis value
float fY
y-axis value

◆ Parse< SkScalar >()

template<>
bool skottie::Parse< SkScalar > ( const Value v,
SkScalar s 
)

Definition at line 26 of file SkottieJson.cpp.

26 {
27 // Some versions wrap values as single-element arrays.
28 if (const skjson::ArrayValue* array = v) {
29 if (array->size() > 0) {
30 return Parse((*array)[0], s);
31 }
32 }
33
34 if (const skjson::NumberValue* num = v) {
35 *s = static_cast<SkScalar>(**num);
36 return true;
37 }
38
39 return false;
40}
float SkScalar
Definition extension.cpp:12
struct MyStruct s
bool Parse(const skjson::Value &, T *)

◆ Parse< SkString >()

template<>
bool skottie::Parse< SkString > ( const Value v,
SkString s 
)

Definition at line 85 of file SkottieJson.cpp.

85 {
86 if (const skjson::StringValue* sv = v) {
87 s->set(sv->begin(), sv->size());
88 return true;
89 }
90
91 return false;
92}

◆ Parse< SkV2 >()

template<>
bool skottie::Parse< SkV2 > ( const Value v,
SkV2 v2 
)

Definition at line 95 of file SkottieJson.cpp.

95 {
96 if (!v.is<ArrayValue>())
97 return false;
98 const auto& av = v.as<ArrayValue>();
99
100 // We need at least two scalars (BM sometimes exports a third value == 0).
101 return av.size() >= 2
102 && Parse<SkScalar>(av[0], &v2->x)
103 && Parse<SkScalar>(av[1], &v2->y);
104}
Vec2Value v2
size_t size() const
Definition SkJSON.h:262

◆ Parse< VectorValue >()

template<>
bool skottie::Parse< VectorValue > ( const Value v,
VectorValue vec 
)

Definition at line 117 of file SkottieJson.cpp.

117 {
118 if (!v.is<ArrayValue>())
119 return false;
120 const auto& av = v.as<ArrayValue>();
121
122 vec->resize(av.size());
123 for (size_t i = 0; i < av.size(); ++i) {
124 if (!Parse(av[i], vec->data() + i)) {
125 return false;
126 }
127 }
128
129 return true;
130}

◆ parse_array()

static bool skottie::parse_array ( const skjson::ArrayValue ja,
float *  a,
size_t  count 
)
static

Definition at line 37 of file VectorKeyframeAnimator.cpp.

37 {
38 if (!ja || ja->size() != count) {
39 return false;
40 }
41
42 for (size_t i = 0; i < count; ++i) {
43 if (!Parse((*ja)[i], a + i)) {
44 return false;
45 }
46 }
47
48 return true;
49}
int count
struct MyStruct a[10]
static const char * ja
Definition fontmgr.cpp:72

◆ parse_encoding_data()

static bool skottie::parse_encoding_data ( const skjson::Value jv,
size_t  data_len,
float  data[] 
)
static

Definition at line 74 of file ShapeKeyframeAnimator.cpp.

74 {
75 const auto* jshape = shape_root(jv);
76 if (!jshape) {
77 return false;
78 }
79
80 // vertices are required, in/out tangents are optional
81 const skjson::ArrayValue* jvs = (*jshape)["v"]; // vertex points
82 const skjson::ArrayValue* jis = (*jshape)["i"]; // in-tangent points
83 const skjson::ArrayValue* jos = (*jshape)["o"]; // out-tangent points
84
85 if (!jvs || data_len != shape_encoding_len(jvs->size())) {
86 return false;
87 }
88
89 auto parse_point = [](const skjson::ArrayValue* ja, size_t i, float* x, float* y) {
90 SkASSERT(ja);
91 const skjson::ArrayValue* jpt = (*ja)[i];
92
93 if (!jpt || jpt->size() != 2ul) {
94 return false;
95 }
96
97 return Parse((*jpt)[0], x) && Parse((*jpt)[1], y);
98 };
99
100 auto parse_optional_point = [&parse_point](const skjson::ArrayValue* ja, size_t i,
101 float* x, float* y) {
102 if (!ja || i >= ja->size()) {
103 // default control point
104 *x = *y = 0;
105 return true;
106 }
107
108 return parse_point(*ja, i, x, y);
109 };
110
111 for (size_t i = 0; i < jvs->size(); ++i) {
112 float* dst = data + i * kFloatsPerVertex;
113 SkASSERT(dst + kFloatsPerVertex <= data + data_len);
114
115 if (!parse_point (jvs, i, dst + kX_Index, dst + kY_Index) ||
116 !parse_optional_point(jis, i, dst + kInX_Index, dst + kInY_Index) ||
117 !parse_optional_point(jos, i, dst + kOutX_Index, dst + kOutY_Index)) {
118 return false;
119 }
120 }
121
122 // "closed" flag
123 data[data_len - 1] = ParseDefault<bool>((*jshape)["c"], false);
124
125 return true;
126}
#define SkASSERT(cond)
Definition SkAssert.h:116
double y
double x
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
dst
Definition cp.py:12
static const skjson::ObjectValue * shape_root(const skjson::Value &jv)

◆ parse_encoding_len()

static bool skottie::parse_encoding_len ( const skjson::Value jv,
size_t *  len 
)
static

Definition at line 64 of file ShapeKeyframeAnimator.cpp.

64 {
65 if (const auto* jshape = shape_root(jv)) {
66 if (const skjson::ArrayValue* jvs = (*jshape)["v"]) {
67 *len = shape_encoding_len(jvs->size());
68 return true;
69 }
70 }
71 return false;
72}
static size_t shape_encoding_len(size_t vertex_count)

◆ ParseDefault()

template<typename T >
T skottie::ParseDefault ( const skjson::Value v,
const T defaultValue 
)

Definition at line 23 of file SkottieJson.h.

23 {
24 T res;
25 if (!Parse<T>(v, &res)) {
26 res = defaultValue;
27 }
28 return res;
29}
#define T

◆ ParseIntegral()

template<typename T >
bool skottie::ParseIntegral ( const Value v,
T result 
)

Definition at line 59 of file SkottieJson.cpp.

59 {
60 if (const skjson::NumberValue* num = v) {
61 const auto dbl = **num;
62 if (dbl > static_cast<double>(std::numeric_limits<T>::max()) ||
63 dbl < static_cast<double>(std::numeric_limits<T>::min())) {
64 return false;
65 }
66
67 *result = static_cast<T>(dbl);
68 return true;
69 }
70
71 return false;
72}
GAsyncResult * result

◆ ParseSlotID()

const skjson::StringValue * skottie::ParseSlotID ( const skjson::ObjectValue jobj)

Definition at line 132 of file SkottieJson.cpp.

132 {
133 if (jobj) {
134 if (const skjson::StringValue* sid = (*jobj)["sid"]) {
135 return sid;
136 }
137 }
138 return nullptr;
139}

◆ shape_encoding_len()

static size_t skottie::shape_encoding_len ( size_t  vertex_count)
static

Definition at line 49 of file ShapeKeyframeAnimator.cpp.

49 {
50 return vertex_count * kFloatsPerVertex + 1;
51}

◆ shape_root()

static const skjson::ObjectValue * skottie::shape_root ( const skjson::Value jv)
static

Definition at line 54 of file ShapeKeyframeAnimator.cpp.

54 {
55 if (const skjson::ArrayValue* av = jv) {
56 if (av->size() == 1) {
57 return (*av)[0];
58 }
59 }
60
61 return jv;
62}