31static constexpr char gThresholdSkSL[] =
34 "half4 main(half4 color) {"
35 "half4 c = unpremul(color);"
37 "half lum = dot(c.rgb, half3(0.2126, 0.7152, 0.0722)),"
40 "return bw.xxx1 * c.a;"
52class ThresholdAdapter final :
public DiscardableAdapterBase<ThresholdAdapter,
53 sksg::ExternalColorFilter> {
57 const AnimationBuilder& abuilder)
64 EffectBinder(jprops, abuilder,
this).bind(kLevel_Index, fLevel);
68 void onSync()
override {
72 this->node()->setColorFilter(std::move(cf));
77 using INHERITED = DiscardableAdapterBase<ThresholdAdapter, sksg::ExternalColorFilter>;
#define INHERITED(method,...)
sk_sp< T > sk_ref_sp(T *obj)
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
static Result MakeForColorFilter(SkString sksl, const Options &)
void attachDiscardableAdapter(sk_sp< T > adapter) const
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)