55 const float tint_matrix[] = {
56 0, 0, 0, (r_hi - r_lo) / 255.0f,
SkIntToScalar(r_lo) / 255.0f,
57 0, 0, 0, (g_hi - g_lo) / 255.0f,
SkIntToScalar(g_lo) / 255.0f,
58 0, 0, 0, (b_hi - b_lo) / 255.0f,
SkIntToScalar(b_lo) / 255.0f,
59 0, 0, 0, (a_hi - a_lo) / 255.0f,
SkIntToScalar(a_lo) / 255.0f,
69 MixerCFGM(
const SkSize& tileSize,
size_t tileCount)
71 , fTileCount(tileCount) {}
78 fTileSize.height() * 1.2f * 3);
86 fTileSize.height() / 2,
87 gradient_colors,
nullptr,
88 std::size(gradient_colors)));
93 this->mixRow(canvas,
paint,
nullptr, cf1);
94 this->mixRow(canvas,
paint, cf0,
nullptr);
95 this->mixRow(canvas,
paint, cf0, cf1);
100 const size_t fTileCount;
107 { 1.0f, 1.0f, 1.0f, 1.0f },
108 { 1.0f, 1.0f, 1.0f, 0.5f },
109 { 0.5f, 0.5f, 1.0f, 1.0f },
110 { 0.5f, 0.5f, 1.0f, 0.5f },
116 for (
size_t i = 0; i < fTileCount; ++i) {
117 paint.setColor4f(paintColors[i % std::size(paintColors)]);
118 float t =
static_cast<float>(i) / (fTileCount - 1);
#define SkColorGetR(color)
#define SkColorGetG(color)
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
#define SkColorGetA(color)
#define SkColorGetB(color)
#define INHERITED(method,...)
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
sk_sp< SkColorFilter > makeComposed(sk_sp< SkColorFilter > inner) const
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > Lerp(float t, sk_sp< SkColorFilter > dst, sk_sp< SkColorFilter > src)
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
virtual SkISize getISize()=0
virtual SkString getName() const =0
virtual DrawResult onDraw(SkCanvas *, SkString *errorMsg)
static sk_sp< SkColorFilter > MakeTintColorFilter(SkColor lo, SkColor hi, bool useSkSL)
static sk_sp< SkColorFilter > MakeTintColorFilter(SkColor lo, SkColor hi)
static constexpr SkISize Make(int32_t w, int32_t h)
static sk_sp< SkColorFilter > Make()
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkSize Make(SkScalar w, SkScalar h)