105 {
107
109 *errorMsg =
SkStringPrintf(
"Unable to instantiate emoji test font of format %s.",
112 }
113
116 size_t textLen = strlen(
text);
117
118
119 constexpr SkScalar textSizes[] = { 10, 30, 50 };
122 for (const bool& fakeBold : { false, true }) {
123 font.setEmbolden(fakeBold);
124 for (
const SkScalar& textSize : textSizes) {
125 font.setSize(textSize);
126 font.getMetrics(&metrics);
131 }
132 }
133
134
136 font.getMetrics(&metrics);
139
142
143 for (int makeLinear = 0; makeLinear < 2; makeLinear++) {
144 for (int makeBlur = 0; makeBlur < 2; makeBlur++) {
145 for (int makeGray = 0; makeGray < 2; makeGray++) {
146 for (int makeMode = 0; makeMode < 2; ++makeMode) {
147 for (int alpha = 0; alpha < 2; ++alpha) {
152 }
153
162 }
163 if (makeMode) {
165 }
166 if (alpha) {
168 }
169 shaderFont.setSize(30);
170 shaderFont.getMetrics(&metrics);
173 shaderFont, shaderPaint);
175 }
176 }
177 }
178 }
179 }
180
183
184
187
192
194 boundsHalfWidth, boundsHalfHeight);
196 boundsHalfWidth, boundsHalfHeight);
198 interiorClip.
inset(boundsQuarterWidth, boundsQuarterHeight);
199
200 const SkRect clipRects[] = {
bounds, upperLeftClip, lowerRightClip, interiorClip };
201
205
211 paint.setAlpha(0x20);
214 paint.setAlphaf(1.0f);
218 }
219
221 }
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorWHITE
@ kUTF8
uses bytes to represent UTF-8 or ASCII
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
static constexpr bool SkToBool(const T &x)
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)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void setStyle(Style style)
void setColor(SkColor color)
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
@ kStroke_Style
set to stroke geometry
void setShader(sk_sp< SkShader > shader)
void setColorFilter(sk_sp< SkColorFilter > colorFilter)
ToolUtils::EmojiTestSample emojiFont
static sk_sp< SkImageFilter > make_grayscale(sk_sp< SkImageFilter > input)
static sk_sp< SkShader > MakeLinear()
static sk_sp< SkImageFilter > make_blur(float amount, sk_sp< SkImageFilter > input)
static sk_sp< SkColorFilter > make_color_filter()
Optional< SkRect > bounds
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
font
Font Metadata and Metrics.
SkScalar fLeading
distance to add between lines, typically positive or zero
SkScalar fAscent
distance to reserve above baseline, typically negative
SkScalar fDescent
distance to reserve below baseline, typically positive
void inset(float dx, float dy)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)