91 for (
size_t i = 0; i < std::size(
gModes); i++) {
93 DrawClippedBitmap(canvas, fBitmap,
paint,
x,
y);
102 DrawClippedBitmap(canvas, fBitmap,
paint,
x,
y);
110 DrawClippedBitmap(canvas, fBitmap,
paint,
x,
y);
126 DrawClippedPaint(canvas, clipRect,
paint,
x,
y);
135 DrawClippedPaint(canvas, clipRect,
paint,
x,
y);
142 constexpr size_t nbSamples = 3;
146 int offsets[nbSamples][4] = {{ 10, 10, -16, -16},
149 for (
size_t i = 0; i < nbSamples; ++i) {
152 fBitmap.
width() + offsets[i][2],
153 fBitmap.
height() + offsets[i][3]);
155 offsetForeground, &cropRect));
156 DrawClippedPaint(canvas, clipRect,
paint,
x,
y);
167 DrawClippedPaint(canvas, clipRect,
paint,
x,
y);
175 DrawClippedPaint(canvas, clipRect,
paint,
x,
y);
187 DrawClippedPaint(canvas, clipRect,
paint,
x,
y);
217 using INHERITED =
GM;
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
constexpr SkColor SK_ColorBLACK
constexpr SkBlendMode gModes[]
sk_sp< SkImage > asImage() const
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void clipIRect(const SkIRect &irect, SkClipOp op=SkClipOp::kIntersect)
void drawPaint(const SkPaint &paint)
void clear(SkColor color)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkImageFilter > Arithmetic(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Offset(SkScalar dx, SkScalar dy, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
GM(SkColor backgroundColor=SK_ColorWHITE)
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
void onOnceBeforeDraw() override
SkString getName() const override
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeWH(float w, float h)