34class GlowAdapter final :
public DiscardableAdapterBase<GlowAdapter, sksg::ExternalImageFilter> {
43 this->bind(abuilder, jstyle[
"c" ], fColor);
44 this->bind(abuilder, jstyle[
"o" ], fOpacity);
45 this->bind(abuilder, jstyle[
"s" ], fSize);
46 this->bind(abuilder, jstyle[
"sr"], fInnerSource);
47 this->bind(abuilder, jstyle[
"ch"], fChoke);
51 void onSync()
override {
53 opacity =
SkTPin(fOpacity / 100, 0.0f, 1.0f),
54 choke =
SkTPin(fChoke / 100, 0.0f, 1.0f);
80 0, 0, 0, opacity *
color.fA, 0
84 const auto requires_alpha_choke = (sigma > 0 && choke > 0);
86 if (!requires_alpha_choke) {
88 mask_cm.postConcat(color_cm);
97 if (requires_alpha_choke) {
105 static constexpr float kMaxAlphaScale = 1e6f,
107 const auto alpha_scale =
113 0, 0, 0, alpha_scale, 0);
124 if (fType == Type::kInnerGlow) {
146 fInnerSource =
kEdge;
148 using INHERITED = DiscardableAdapterBase<GlowAdapter, sksg::ExternalImageFilter>;
152 const AnimationBuilder& abuilder,
155 auto filter_node = abuilder.attachDiscardableAdapter<GlowAdapter>(jstyle, abuilder,
type);
164 return make_glow_effect(jstyle, *fBuilder, std::move(layer), GlowAdapter::Type::kOuterGlow);
169 return make_glow_effect(jstyle, *fBuilder, std::move(layer), GlowAdapter::Type::kInnerGlow);
static constexpr float sk_ieee_float_divide(float numer, float denom)
#define INHERITED(method,...)
void swap(sk_sp< T > &a, sk_sp< T > &b)
#define SkScalarRoundToInt(x)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
void preConcat(const SkColorMatrix &mat)
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< RenderNode > Make(sk_sp< RenderNode > child, sk_sp< ImageFilter > filter)
static float min(float r, float g, float b)
static constexpr float kBlurSizeToSigma