36class LinearWipeAdapter final :
public MaskShaderEffectBase {
41 const AnimationBuilder* abuilder) {
52 const AnimationBuilder* abuilder)
55 kCompletion_Index = 0,
60 EffectBinder(jprops, *abuilder,
this)
61 .bind(kCompletion_Index, fCompletion)
62 .bind( kAngle_Index, fAngle )
63 .bind( kFeather_Index, fFeather );
66 MaskInfo onMakeMask()
const override {
67 if (fCompletion >= 100) {
73 if (fCompletion <= 0) {
75 return {
nullptr,
true };
78 const auto t =
SkTPin(fCompletion * 0.01f, 0.0f, 1.0f),
81 cos_ = std::cos(angle),
82 sin_ = std::sin(angle);
86 diag_v = {std::copysign(this->layerSize().
width() ,
cos_),
87 std::copysign(this->layerSize().
height(),
sin_)};
93 const auto grad_len =
len + feather * 2;
94 const SkVector grad_v = angle_v * grad_len,
95 adjusted_grad_v = { grad_v.
fX, -grad_v.
fY },
96 center_v = {0.5f * this->layerSize().width(),
97 0.5f * this->layerSize().height()};
101 center_v - adjusted_grad_v * 0.5f,
102 center_v + adjusted_grad_v * 0.5f,
115 const auto adjusted_t = t * (
len + feather) / grad_len;
117 adjusted_t + feather / grad_len };
constexpr SkColor SK_ColorTRANSPARENT
#define INHERITED(method,...)
#define SkDegreesToRadians(degrees)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
void attachDiscardableAdapter(sk_sp< T > adapter) const
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)
PODArray< SkColor > colors
SK_API sk_sp< SkShader > Color(SkColor)
static float DotProduct(const SkVector &a, const SkVector &b)