32class ShadowAdapter final :
public DiscardableAdapterBase<ShadowAdapter,
33 sksg::ExternalImageFilter> {
41 const AnimationBuilder& abuilder,
44 this->bind(abuilder, jstyle[
"c"], fColor);
45 this->bind(abuilder, jstyle[
"o"], fOpacity);
46 this->bind(abuilder, jstyle[
"a"], fAngle);
47 this->bind(abuilder, jstyle[
"s"], fSize);
48 this->bind(abuilder, jstyle[
"d"], fDistance);
52 void onSync()
override {
55 opacity =
SkTPin(fOpacity / 100, 0.0f, 1.0f);
82 0, 0, 0, opacity *
color.fA, 0};
85 if (fType == Type::kInnerShadow) {
86 cm.preConcat({1, 0, 0, 0, 0,
103 if (fType == Type::kInnerShadow) {
122 using INHERITED = DiscardableAdapterBase<ShadowAdapter, sksg::ExternalImageFilter>;
126 const AnimationBuilder& abuilder,
129 auto filter_node = abuilder.attachDiscardableAdapter<ShadowAdapter>(jstyle, abuilder,
type);
138 return make_shadow_effect(jstyle, *fBuilder, std::move(layer),
139 ShadowAdapter::Type::kDropShadow);
144 return make_shadow_effect(jstyle, *fBuilder, std::move(layer),
145 ShadowAdapter::Type::kInnerShadow);
#define INHERITED(method,...)
void swap(sk_sp< T > &a, sk_sp< T > &b)
#define SkDegreesToRadians(degrees)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
#define SkScalarSin(radians)
#define SkScalarCos(radians)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Merge(sk_sp< SkImageFilter > *const filters, int count, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Offset(SkScalar dx, SkScalar dy, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< RenderNode > Make(sk_sp< RenderNode > child, sk_sp< ImageFilter > filter)
static constexpr float kBlurSizeToSigma