38static uint16_t
gData[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
40class ColorEmojiBlendModesGM :
public skiagm::GM {
42 const static int W = 64;
43 const static int H = 64;
55 paint.setAntiAlias(
true);
75 if (!fColorSample.typeface) {
76 *errorMsg =
SkStringPrintf(
"Unable to instantiate emoji test font of format %s.",
126 SkFont textFont(fColorSample.typeface, 70);
133 for (
size_t i = 0; i < std::size(
gModes); i++) {
144 p.setShader(
nullptr);
151 const char*
text = fColorSample.sampleText;
155 x+
w/10.f,
y + 7.f*
h/8.f, textFont, textP);
163 if ((i % kWrap) == kWrap - 1) {
@ kOpaque_SkAlphaType
pixel is opaque
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
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
@ kUTF32
uses four byte words to represent all of Unicode
#define INHERITED(method,...)
SK_API SkString static SkString SkStringPrintf()
constexpr SkBlendMode gModes[]
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
static constexpr SkFontStyle Bold()
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)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
void setBlendMode(SkBlendMode mode)
static void DrawString(SkCanvas *canvas, const char text[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint, Align align=kLeft_Align)
virtual SkISize getISize()=0
virtual void onOnceBeforeDraw()
virtual SkString getName() const =0
virtual DrawResult onDraw(SkCanvas *, SkString *errorMsg)
uint32_t uint32_t * format
PODArray< SkColor > colors
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
void inset(float dx, float dy)
void setLTRB(float left, float top, float right, float bottom)