Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
skottie::internal::ShapeBuilder Class Referencefinal

#include <ShapeLayer.h>

Inheritance diagram for skottie::internal::ShapeBuilder:
SkNoncopyable

Static Public Member Functions

static sk_sp< sksg::MergeMergeGeometry (std::vector< sk_sp< sksg::GeometryNode > > &&, sksg::Merge::Mode)
 
static sk_sp< sksg::GeometryNodeAttachPathGeometry (const skjson::ObjectValue &, const AnimationBuilder *)
 
static sk_sp< sksg::GeometryNodeAttachRRectGeometry (const skjson::ObjectValue &, const AnimationBuilder *)
 
static sk_sp< sksg::GeometryNodeAttachEllipseGeometry (const skjson::ObjectValue &, const AnimationBuilder *)
 
static sk_sp< sksg::GeometryNodeAttachPolystarGeometry (const skjson::ObjectValue &, const AnimationBuilder *)
 
static sk_sp< sksg::PaintNodeAttachColorFill (const skjson::ObjectValue &, const AnimationBuilder *)
 
static sk_sp< sksg::PaintNodeAttachColorStroke (const skjson::ObjectValue &, const AnimationBuilder *)
 
static sk_sp< sksg::PaintNodeAttachGradientFill (const skjson::ObjectValue &, const AnimationBuilder *)
 
static sk_sp< sksg::PaintNodeAttachGradientStroke (const skjson::ObjectValue &, const AnimationBuilder *)
 
static std::vector< sk_sp< sksg::GeometryNode > > AttachMergeGeometryEffect (const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::GeometryNode > > &&)
 
static std::vector< sk_sp< sksg::GeometryNode > > AttachTrimGeometryEffect (const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::GeometryNode > > &&)
 
static std::vector< sk_sp< sksg::GeometryNode > > AttachRoundGeometryEffect (const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::GeometryNode > > &&)
 
static std::vector< sk_sp< sksg::GeometryNode > > AttachOffsetGeometryEffect (const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::GeometryNode > > &&)
 
static std::vector< sk_sp< sksg::GeometryNode > > AttachPuckerBloatGeometryEffect (const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::GeometryNode > > &&)
 
static std::vector< sk_sp< sksg::GeometryNode > > AdjustStrokeGeometry (const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::GeometryNode > > &&)
 
static std::vector< sk_sp< sksg::RenderNode > > AttachRepeaterDrawEffect (const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::RenderNode > > &&)
 

Detailed Description

Definition at line 37 of file ShapeLayer.h.

Member Function Documentation

◆ AdjustStrokeGeometry()

std::vector< sk_sp< sksg::GeometryNode > > skottie::internal::ShapeBuilder::AdjustStrokeGeometry ( const skjson::ObjectValue jstroke,
const AnimationBuilder abuilder,
std::vector< sk_sp< sksg::GeometryNode > > &&  geos 
)
static

Definition at line 181 of file FillStroke.cpp.

184 {
185
186 const skjson::ArrayValue* jdash = jstroke["d"];
187 if (jdash && jdash->size() > 1) {
188 for (size_t i = 0; i < geos.size(); ++i) {
189 geos[i] = abuilder->attachDiscardableAdapter<DashAdapter>(
190 *jdash, *abuilder, std::move(geos[i]));
191 }
192 }
193
194 return std::move(geos);
195}
size_t size() const
Definition: SkJSON.h:262

◆ AttachColorFill()

sk_sp< sksg::PaintNode > skottie::internal::ShapeBuilder::AttachColorFill ( const skjson::ObjectValue jpaint,
const AnimationBuilder abuilder 
)
static

Definition at line 165 of file FillStroke.cpp.

166 {
167 auto color_node = sksg::Color::Make(SK_ColorBLACK);
168 auto color_paint = AttachFill(jpaint, abuilder, color_node);
169 abuilder->dispatchColorProperty(color_node);
170 return color_paint;
171}
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
static sk_sp< Color > Make(SkColor c)
Definition: SkSGPaint.cpp:44

◆ AttachColorStroke()

sk_sp< sksg::PaintNode > skottie::internal::ShapeBuilder::AttachColorStroke ( const skjson::ObjectValue jpaint,
const AnimationBuilder abuilder 
)
static

Definition at line 173 of file FillStroke.cpp.

174 {
175 auto color_node = sksg::Color::Make(SK_ColorBLACK);
176 auto color_paint = AttachStroke(jpaint, abuilder, color_node);
177 abuilder->dispatchColorProperty(color_node);
178 return color_paint;
179}

◆ AttachEllipseGeometry()

sk_sp< sksg::GeometryNode > skottie::internal::ShapeBuilder::AttachEllipseGeometry ( const skjson::ObjectValue jellipse,
const AnimationBuilder abuilder 
)
static

Definition at line 57 of file Ellipse.cpp.

58 {
59 return abuilder->attachDiscardableAdapter<EllipseGeometryAdapter>(jellipse, abuilder);
60}

◆ AttachGradientFill()

sk_sp< sksg::PaintNode > skottie::internal::ShapeBuilder::AttachGradientFill ( const skjson::ObjectValue jgrad,
const AnimationBuilder abuilder 
)
static

Definition at line 250 of file Gradient.cpp.

251 {
252 auto adapter = GradientAdapter::Make(jgrad, *abuilder);
253
254 return adapter
255 ? AttachFill(jgrad, abuilder, sksg::ShaderPaint::Make(adapter->node()), adapter)
256 : nullptr;
257}
static sk_sp< ShaderPaint > Make(sk_sp< Shader >)
Definition: SkSGPaint.cpp:60
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)

◆ AttachGradientStroke()

sk_sp< sksg::PaintNode > skottie::internal::ShapeBuilder::AttachGradientStroke ( const skjson::ObjectValue jgrad,
const AnimationBuilder abuilder 
)
static

Definition at line 259 of file Gradient.cpp.

260 {
261 auto adapter = GradientAdapter::Make(jgrad, *abuilder);
262
263 return adapter
264 ? AttachStroke(jgrad, abuilder, sksg::ShaderPaint::Make(adapter->node()), adapter)
265 : nullptr;
266}

◆ AttachMergeGeometryEffect()

std::vector< sk_sp< sksg::GeometryNode > > skottie::internal::ShapeBuilder::AttachMergeGeometryEffect ( const skjson::ObjectValue jmerge,
const AnimationBuilder ,
std::vector< sk_sp< sksg::GeometryNode > > &&  geos 
)
static

Definition at line 37 of file MergePaths.cpp.

39 {
40 static constexpr sksg::Merge::Mode gModes[] = {
45 sksg::Merge::Mode::kXOR , // "mm": 5
46 };
47
48 const auto mode = gModes[std::min<size_t>(ParseDefault<size_t>(jmerge["mm"], 1) - 1,
49 std::size(gModes) - 1)];
50
51 std::vector<sk_sp<sksg::GeometryNode>> merged;
52 merged.push_back(ShapeBuilder::MergeGeometry(std::move(geos), mode));
53
54 return merged;
55}
constexpr SkBlendMode gModes[]
Definition: aarectmodes.cpp:73
static sk_sp< sksg::Merge > MergeGeometry(std::vector< sk_sp< sksg::GeometryNode > > &&, sksg::Merge::Mode)
Definition: MergePaths.cpp:24
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ AttachOffsetGeometryEffect()

std::vector< sk_sp< sksg::GeometryNode > > skottie::internal::ShapeBuilder::AttachOffsetGeometryEffect ( const skjson::ObjectValue jround,
const AnimationBuilder abuilder,
std::vector< sk_sp< sksg::GeometryNode > > &&  geos 
)
static

Definition at line 61 of file OffsetPaths.cpp.

63 {
64 std::vector<sk_sp<sksg::GeometryNode>> offsetted;
65 offsetted.reserve(geos.size());
66
67 for (auto& g : geos) {
68 offsetted.push_back(abuilder->attachDiscardableAdapter<OffsetPathsAdapter>
69 (jround, *abuilder, std::move(g)));
70 }
71
72 return offsetted;
73}

◆ AttachPathGeometry()

sk_sp< sksg::GeometryNode > skottie::internal::ShapeBuilder::AttachPathGeometry ( const skjson::ObjectValue jpath,
const AnimationBuilder abuilder 
)
static

Definition at line 153 of file ShapeLayer.cpp.

154 {
155 return abuilder->attachPath(jpath["ks"]);
156}

◆ AttachPolystarGeometry()

sk_sp< sksg::GeometryNode > skottie::internal::ShapeBuilder::AttachPolystarGeometry ( const skjson::ObjectValue jstar,
const AnimationBuilder abuilder 
)
static

Definition at line 101 of file Polystar.cpp.

102 {
103 static constexpr PolystarGeometryAdapter::Type gTypes[] = {
104 PolystarGeometryAdapter::Type::kStar, // "sy": 1
105 PolystarGeometryAdapter::Type::kPoly, // "sy": 2
106 };
107
108 const auto type = ParseDefault<size_t>(jstar["sy"], 0) - 1;
109 if (type >= std::size(gTypes)) {
110 abuilder->log(Logger::Level::kError, &jstar, "Unknown polystar type.");
111 return nullptr;
112 }
113
114 return abuilder->attachDiscardableAdapter<PolystarGeometryAdapter>
115 (jstar, abuilder, gTypes[type]);
116}
Type
Definition: SortBench.cpp:56
GLenum type

◆ AttachPuckerBloatGeometryEffect()

std::vector< sk_sp< sksg::GeometryNode > > skottie::internal::ShapeBuilder::AttachPuckerBloatGeometryEffect ( const skjson::ObjectValue jround,
const AnimationBuilder abuilder,
std::vector< sk_sp< sksg::GeometryNode > > &&  geos 
)
static

Definition at line 165 of file PuckerBloat.cpp.

167 {
168 std::vector<sk_sp<sksg::GeometryNode>> bloated;
169 bloated.reserve(geos.size());
170
171 for (auto& g : geos) {
172 bloated.push_back(abuilder->attachDiscardableAdapter<PuckerBloatAdapter>
173 (jround, *abuilder, std::move(g)));
174 }
175
176 return bloated;
177}

◆ AttachRepeaterDrawEffect()

std::vector< sk_sp< sksg::RenderNode > > skottie::internal::ShapeBuilder::AttachRepeaterDrawEffect ( const skjson::ObjectValue jrepeater,
const AnimationBuilder abuilder,
std::vector< sk_sp< sksg::RenderNode > > &&  draws 
)
static

Definition at line 184 of file Repeater.cpp.

187 {
188 std::vector<sk_sp<sksg::RenderNode>> repeater_draws;
189
190 if (const skjson::ObjectValue* jtransform = jrepeater["tr"]) {
191 // input draws are in top->bottom order - reverse for paint order
192 std::reverse(draws.begin(), draws.end());
193
194 repeater_draws.reserve(1);
195 repeater_draws.push_back(
196 abuilder->attachDiscardableAdapter<RepeaterAdapter>(jrepeater,
197 *jtransform,
198 *abuilder,
199 std::move(draws)));
200 } else {
201 repeater_draws = std::move(draws);
202 }
203
204 return repeater_draws;
205}

◆ AttachRoundGeometryEffect()

std::vector< sk_sp< sksg::GeometryNode > > skottie::internal::ShapeBuilder::AttachRoundGeometryEffect ( const skjson::ObjectValue jround,
const AnimationBuilder abuilder,
std::vector< sk_sp< sksg::GeometryNode > > &&  geos 
)
static

Definition at line 47 of file RoundCorners.cpp.

49 {
50 std::vector<sk_sp<sksg::GeometryNode>> rounded;
51 rounded.reserve(geos.size());
52
53 for (auto& g : geos) {
54 rounded.push_back(
55 abuilder->attachDiscardableAdapter<RoundCornersAdapter>
56 (jround, *abuilder, std::move(g)));
57 }
58
59 return rounded;
60}

◆ AttachRRectGeometry()

sk_sp< sksg::GeometryNode > skottie::internal::ShapeBuilder::AttachRRectGeometry ( const skjson::ObjectValue jrect,
const AnimationBuilder abuilder 
)
static

Definition at line 59 of file Rectangle.cpp.

60 {
61 return abuilder->attachDiscardableAdapter<RectangleGeometryAdapter>(jrect, abuilder);
62}

◆ AttachTrimGeometryEffect()

std::vector< sk_sp< sksg::GeometryNode > > skottie::internal::ShapeBuilder::AttachTrimGeometryEffect ( const skjson::ObjectValue jtrim,
const AnimationBuilder abuilder,
std::vector< sk_sp< sksg::GeometryNode > > &&  geos 
)
static

Definition at line 81 of file TrimPaths.cpp.

84 {
85
86 enum class Mode {
87 kParallel, // "m": 1 (Trim Multiple Shapes: Simultaneously)
88 kSerial, // "m": 2 (Trim Multiple Shapes: Individually)
89 } gModes[] = { Mode::kParallel, Mode::kSerial};
90
91 const auto mode = gModes[std::min<size_t>(ParseDefault<size_t>(jtrim["m"], 1) - 1,
92 std::size(gModes) - 1)];
93
94 std::vector<sk_sp<sksg::GeometryNode>> inputs;
95 if (mode == Mode::kSerial) {
97 } else {
98 inputs = std::move(geos);
99 }
100
101 std::vector<sk_sp<sksg::GeometryNode>> trimmed;
102 trimmed.reserve(inputs.size());
103
104 for (const auto& i : inputs) {
105 trimmed.push_back(
106 abuilder->attachDiscardableAdapter<TrimEffectAdapter>(jtrim, *abuilder, i));
107 }
108
109 return trimmed;
110}

◆ MergeGeometry()

sk_sp< sksg::Merge > skottie::internal::ShapeBuilder::MergeGeometry ( std::vector< sk_sp< sksg::GeometryNode > > &&  geos,
sksg::Merge::Mode  mode 
)
static

Definition at line 24 of file MergePaths.cpp.

25 {
26 std::vector<sksg::Merge::Rec> merge_recs;
27 merge_recs.reserve(geos.size());
28
29 for (auto& geo : geos) {
30 merge_recs.push_back(
31 {std::move(geo), merge_recs.empty() ? sksg::Merge::Mode::kMerge : mode});
32 }
33
34 return sksg::Merge::Make(std::move(merge_recs));
35}
static sk_sp< Merge > Make(std::vector< Rec > &&recs)
Definition: SkSGMerge.h:49

The documentation for this class was generated from the following files: