35#define FILTER_WIDTH SkIntToScalar(30)
36#define FILTER_HEIGHT SkIntToScalar(30)
37#define MARGIN SkIntToScalar(10)
41 1, 0, 0, 0, brightness,
42 0, 1, 0, 0, brightness,
43 0, 0, 1, 0, brightness,
50 memset(matrix, 0, 20 *
sizeof(
float));
51 matrix[0] = matrix[5] = matrix[10] = 0.2126f;
52 matrix[1] = matrix[6] = matrix[11] = 0.7152f;
53 matrix[2] = matrix[7] = matrix[12] = 0.0722f;
71 const SkPoint pts[] = { { 0, 0 }, { 100, 100 } };
77 const SkPoint pts[] = { { 0, 0 }, { 100, 100 } };
92 array->push_back(std::move(shader));
95 array->push_back(std::move(shader));
98 array->push_back(std::move(shader));
137 for (
float brightness = -1.0f; brightness <= 1.0f; brightness += 0.2f) {
140 paint.setImageFilter(std::move(bright));
149 paint.setImageFilter(std::move(grayscale));
156 paint.setImageFilter(std::move(brightness));
163 paint.setImageFilter(std::move(brightness));
170 paint.setImageFilter(std::move(blue));
177 paint.setImageFilter(std::move(brightness));
183 paint.setImageFilter(std::move(blue));
196 canvas->saveLayer(
nullptr, &p);
215 canvas->translate(20, 20);
220 for (
int x = -1;
x < filters.
size(); ++
x) {
224 canvas->drawRect(r,
paint);
225 canvas->translate(150, 0);
228 canvas->translate(0, 150);
static sk_sp< SkColorFilter > make_grayscale()
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
constexpr int SkToInt(S x)
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
void setSaturation(float sat)
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
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 sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
sk_sp< SkShader > makeWithColorFilter(sk_sp< SkColorFilter >) const
static sk_sp< SkImageFilter > make_mode_blue(sk_sp< SkImageFilter > input)
static void draw_clipped_rect(SkCanvas *canvas, const SkRect &r, const SkPaint &paint, float outset=0.0f)
static sk_sp< SkShader > sh_make_lineargradient1()
static sk_sp< SkImageFilter > make_brightness(float amount, sk_sp< SkImageFilter > input)
static sk_sp< SkShader > sh_make_image()
static void sk_gm_get_shaders(TArray< sk_sp< SkShader > > *array)
static sk_sp< SkColorFilter > cf_make_colorize(SkColor color)
static sk_sp< SkShader > sh_make_lineargradient0()
static sk_sp< SkImageFilter > make_blur(float amount, sk_sp< SkImageFilter > input)
static sk_sp< SkColorFilter > cf_make_grayscale()
static sk_sp< SkColorFilter > cf_make_brightness(float brightness)
static void sk_gm_get_colorfilters(TArray< sk_sp< SkColorFilter > > *array)
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
static constexpr SkRect MakeWH(float w, float h)