30 { bounds.left(), bounds.top() },
31 { bounds.right(), bounds.bottom() },
44 paint->setColorFilter(
nullptr);
57 SkRect r = {0, 0, 600, 50};
64 uint32_t fData0, fData1;
76 for (
size_t i = 0; i < std::size(rec); ++i) {
77 rec[i].fProc(&
paint, rec[i].fData0, rec[i].fData1);
99 { 0xffff0000, 0xff00ff00, 0xff0000ff, 0xffff0000 },
100 { 0xdfc08040, 0xdf8040c0, 0xdf40c080, 0xdfc08040 },
103 for (
const auto& cols :
gGrads) {
105 cols,
nullptr, std::size(cols),
112 using std::make_tuple;
114 static constexpr struct {
115 std::tuple<float, float>
h,
s, l;
117 { make_tuple(-0.5f, 0.5f), make_tuple( 0.0f, 0.0f), make_tuple( 0.0f, 0.0f) },
118 { make_tuple( 0.0f, 0.0f), make_tuple(-1.0f, 1.0f), make_tuple( 0.0f, 0.0f) },
119 { make_tuple( 0.0f, 0.0f), make_tuple( 0.0f, 0.0f), make_tuple(-1.0f, 1.0f) },
127 for (
const auto& shader : fShaders) {
128 paint.setShader(shader);
130 for (
const auto& tst:
gTests) {
133 const auto dh = (std::get<1>(tst.h) - std::get<0>(tst.h)) / (kSteps - 1),
134 ds = (std::get<1>(tst.s) - std::get<0>(tst.s)) / (kSteps - 1),
135 dl = (std::get<1>(tst.l) - std::get<0>(tst.l)) / (kSteps - 1);
136 auto h = std::get<0>(tst.h),
137 s = std::get<0>(tst.s),
138 l = std::get<0>(tst.l);
141 for (
size_t i = 0; i < kSteps; ++i) {
158 inline static constexpr SkScalar kWheelSize = 100;
159 inline static constexpr size_t kSteps = 7;
163 const auto h_bias =
h,
165 s_bias = std::max(
s, 0.0f),
166 s_scale = 1 - std::abs(
s),
167 l_bias = std::max(l, 0.0f),
168 l_scale = 1 - std::abs(l);
170 const float cm[20] = {
171 h_scale, 0, 0, 0, h_bias,
172 0, s_scale, 0, 0, s_bias,
173 0, 0, l_scale, 0, l_bias,
180 std::vector<sk_sp<SkShader>> fShaders;
static sk_sp< SkShader > make_shader()
static const TestCase gTests[]
static const struct @225 gGrads[]
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
SkString getName() const override
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
void onOnceBeforeDraw() override
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
static sk_sp< SkColorFilter > HSLAMatrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > Lighting(SkColor mul, SkColor add)
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)
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)
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
static void install_nothing(SkPaint *paint, uint32_t, uint32_t)
static void install_lighting(SkPaint *paint, uint32_t mul, uint32_t add)
void(* InstallPaint)(SkPaint *, uint32_t, uint32_t)
static sk_sp< SkImageFilter > make_filter()
constexpr float height() const
static constexpr SkRect MakeWH(float w, float h)