34 const int kBlockSize = atlasSize/2;
63 return surface->makeImageSnapshot();
78 return SkISize::Make(kNumXferModes * (kAtlasSize + kPad) + kPad,
79 2 * kNumColors * (kAtlasSize + kPad) + kTextPad + kPad);
126 const int numModes = std::size(
gModes);
127 SkASSERT(numModes == kNumXferModes);
128 const int numColors = std::size(
gColors);
135 paint.setAntiAlias(
true);
137 for (
int i = 0; i < numColors; ++i) {
145 for (
int i = 0; i < numModes; ++i) {
151 for (
int i = 0; i < numModes; ++i) {
156 canvas->
drawAtlas(atlas.
get(), xforms, rects, quadColors, numColors,
160 canvas->
drawAtlas(atlas.
get(), xforms, rects, quadColors, numColors,
167 inline static constexpr int kNumXferModes = 29;
168 inline static constexpr int kNumColors = 4;
169 inline static constexpr int kAtlasSize = 30;
170 inline static constexpr int kPad = 2;
171 inline static constexpr int kTextPad = 8;
173 using INHERITED =
GM;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static const SkColor gColors[]
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
@ 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_ColorTRANSPARENT
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
constexpr SkBlendMode gModes[]
void onDraw(SkCanvas *canvas) override
SkISize getISize() override
SkString getName() const override
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawAtlas(const SkImage *atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, SkBlendMode mode, const SkSamplingOptions &sampling, const SkRect *cullRect, const SkPaint *paint)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
GM(SkColor backgroundColor=SK_ColorWHITE)
static sk_sp< SkImage > make_atlas(SkCanvas *caller, int atlasSize)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)