31 , fCompBuilder(cbuilder)
32 , fLayerSize(layer_size) {}
34EffectBuilder::EffectBuilderT EffectBuilder::findBuilder(
const skjson::ObjectValue& jeffect)
const {
35 static constexpr struct BuilderInfo {
37 EffectBuilderT fBuilder;
40 {
"ADBE Black&White" , &EffectBuilder::attachBlackAndWhiteEffect },
41 {
"ADBE Brightness & Contrast 2", &EffectBuilder::attachBrightnessContrastEffect },
42 {
"ADBE Bulge" , &EffectBuilder::attachBulgeEffect },
43 {
"ADBE Corner Pin" , &EffectBuilder::attachCornerPinEffect },
44 {
"ADBE Displacement Map" , &EffectBuilder::attachDisplacementMapEffect },
45 {
"ADBE Drop Shadow" , &EffectBuilder::attachDropShadowEffect },
46 {
"ADBE Easy Levels2" , &EffectBuilder::attachEasyLevelsEffect },
47 {
"ADBE Fill" , &EffectBuilder::attachFillEffect },
48 {
"ADBE Fractal Noise" , &EffectBuilder::attachFractalNoiseEffect },
49 {
"ADBE Gaussian Blur 2" , &EffectBuilder::attachGaussianBlurEffect },
50 {
"ADBE Geometry2" , &EffectBuilder::attachTransformEffect },
51 {
"ADBE HUE SATURATION" , &EffectBuilder::attachHueSaturationEffect },
52 {
"ADBE Invert" , &EffectBuilder::attachInvertEffect },
53 {
"ADBE Linear Wipe" , &EffectBuilder::attachLinearWipeEffect },
54 {
"ADBE Motion Blur" , &EffectBuilder::attachDirectionalBlurEffect },
55 {
"ADBE Pro Levels2" , &EffectBuilder::attachProLevelsEffect },
56 {
"ADBE Radial Wipe" , &EffectBuilder::attachRadialWipeEffect },
57 {
"ADBE Ramp" , &EffectBuilder::attachGradientEffect },
58 {
"ADBE Sharpen" , &EffectBuilder::attachSharpenEffect },
59 {
"ADBE Shift Channels" , &EffectBuilder::attachShiftChannelsEffect },
60 {
"ADBE Threshold2" , &EffectBuilder::attachThresholdEffect },
61 {
"ADBE Tile" , &EffectBuilder::attachMotionTileEffect },
62 {
"ADBE Tint" , &EffectBuilder::attachTintEffect },
63 {
"ADBE Tritone" , &EffectBuilder::attachTritoneEffect },
64 {
"ADBE Venetian Blinds" , &EffectBuilder::attachVenetianBlindsEffect },
65 {
"CC Sphere" , &EffectBuilder::attachSphereEffect },
66 {
"CC Toner" , &EffectBuilder::attachCCTonerEffect },
67 {
"SkSL Color Filter" , &EffectBuilder::attachSkSLColorFilter },
68 {
"SkSL Shader" , &EffectBuilder::attachSkSLShader },
73 const BuilderInfo
key { mn->
begin(),
nullptr };
74 const auto* binfo = std::lower_bound(
std::begin(gBuilderInfo),
75 std::end (gBuilderInfo),
77 [](
const BuilderInfo&
a,
const BuilderInfo&
b) {
78 return strcmp(
a.fName,
b.fName) < 0;
80 if (binfo != std::end(gBuilderInfo) && !strcmp(binfo->fName,
key.fName)) {
81 return binfo->fBuilder;
91 kDropShadow_Effect = 25,
92 kRadialWipe_Effect = 26,
93 kGaussianBlur_Effect = 29,
96 switch (ParseDefault<int>(jeffect[
"ty"], -1)) {
97 case kTint_Effect:
return &EffectBuilder::attachTintEffect;
98 case kFill_Effect:
return &EffectBuilder::attachFillEffect;
99 case kTritone_Effect:
return &EffectBuilder::attachTritoneEffect;
100 case kDropShadow_Effect:
return &EffectBuilder::attachDropShadowEffect;
101 case kRadialWipe_Effect:
return &EffectBuilder::attachRadialWipeEffect;
102 case kGaussianBlur_Effect:
return &EffectBuilder::attachGaussianBlurEffect;
107 "Unsupported layer effect: %s", mn ? mn->
begin() :
"(unknown)");
123 const auto builder = this->findBuilder(*jeffect);
130 layer = (this->*
builder)(*jprops, std::move(layer));
143#if !defined(SKOTTIE_DISABLE_STYLES)
151 static constexpr StyleBuilder gStyleBuilders[] = {
153 &EffectBuilder::attachDropShadowStyle,
154 &EffectBuilder::attachInnerShadowStyle,
155 &EffectBuilder::attachOuterGlowStyle,
156 &EffectBuilder::attachInnerGlowStyle,
164 const auto style_type =
166 auto builder = style_type <
std::size(gStyleBuilders) ? gStyleBuilders[style_type]
174 layer = (this->*
builder)(*jstyle, std::move(layer));
185 if (prop_index >= jprops.
size()) {
191 return jprop ? (*jprop)[
"v"] : kNull;
195 : fMaskEffectNode(
sksg::MaskShaderEffect::
Make(
std::move(child)))
198void MaskShaderEffectBase::onSync() {
201 fMaskEffectNode->setVisible(minfo.fVisible);
202 fMaskEffectNode->setShader(std::move(minfo.fMaskShader));
const char * begin() const
void log(Logger::Level, const skjson::Value *, const char fmt[],...) const SK_PRINTF_LIKE(4
sk_sp< sksg::RenderNode > attachEffects(const skjson::ArrayValue &, sk_sp< sksg::RenderNode >) const
EffectBuilder(const AnimationBuilder *, const SkSize &, CompositionBuilder *)
static const skjson::Value & GetPropValue(const skjson::ArrayValue &jprops, size_t prop_index)
sk_sp< sksg::RenderNode > attachStyles(const skjson::ArrayValue &, sk_sp< sksg::RenderNode >) const
MaskShaderEffectBase(sk_sp< sksg::RenderNode >, const SkSize &)
virtual MaskInfo onMakeMask() const =0
static const char * begin(const StringSlice &s)
static float max(float r, float g, float b)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
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