53 {
54 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
55 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
56
57
68
70
71 canvas->
scale(1.05f, 1.05f);
72 canvas->
clear(0xffffffff);
73
75 paint.setAntiAlias(
true);
76
78 font.setSubpixel(
true);
79
80 const char*
text =
"Hamburgefons";
81 const size_t textLen = strlen(
text);
82
83
86 for (size_t i = 0; i < std::size(textSizes); ++i) {
89 canvas->
scale(scales[i], scales[i]);
90 font.setSize(textSizes[i]);
92 y +=
font.getMetrics(
nullptr)*scales[i];
93 }
94
95
96 for (size_t i = 0; i < 5; ++i) {
99
103 for (int ps = 6; ps <= 32; ps += 3) {
106 rotY +=
font.getMetrics(
nullptr);
107 }
108 }
109
110
114 size_t arraySize = std::size(textSizes);
115 for (size_t i = 0; i < arraySize; ++i) {
119 canvas->
scale(scaleFactor, scaleFactor);
120 font.setSize(textSizes[i]);
122 y +=
font.getMetrics(
nullptr)*scaleFactor;
123 }
124
125
126 {
128
129 canvas->
scale(2.0f, 2.0f);
130
134 font.setSize(textSizes[0]);
136
140 }
141
142
143
145 0xFFFFFFFF,
146 0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF,
147 0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
148 0xFF000000,
149 };
150
151 paint.setColor(0xFFF7F3F7);
154
158 for (size_t i = 0; i < std::size(fg); ++i) {
159 paint.setColor(fg[i]);
160
162 y +=
font.getMetrics(
nullptr);
163 }
164
165 paint.setColor(0xFF181C18);
168
172 for (size_t i = 0; i < std::size(fg); ++i) {
173 paint.setColor(fg[i]);
174
176 y +=
font.getMetrics(
nullptr);
177 }
178
179
180 {
183 canvas->
skew(0.0f, 0.151515f);
186 }
187 {
190 canvas->
skew(0.5f, 0.0f);
193 }
194
195
196 {
200 persp.
setAll(0.9839f, 0, 0,
201 0.2246f, 0.6829f, 0,
202 0.0002352f, -0.0003844f, 1);
207 }
208 {
209 font.setSubpixel(
false);
213 persp.
setAll(0.9839f, 0, 0,
214 0.2246f, 0.6829f, 0,
215 0.0002352f, -0.0003844f, 1);
218 canvas->
scale(375, 375);
221 }
222
223
232 670,
233 90,
234 emojiFont,
236 }
237
238
241
244 }
245 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kUTF8
uses bytes to represent UTF-8 or ASCII
@ kGlyphID
uses two byte words to represent glyph indices
#define SkScalarInvert(x)
constexpr int SkToInt(S x)
SkISize getISize() override
bool getProps(SkSurfaceProps *props) const
void drawRect(const SkRect &rect, const SkPaint &paint)
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)
SkMatrix getLocalToDeviceAs3x3() const
virtual GrRecordingContext * recordingContext() const
void clear(SkColor color)
void rotate(SkScalar degrees)
void setMatrix(const SkM44 &matrix)
void scale(SkScalar sx, SkScalar sy)
void concat(const SkMatrix &matrix)
SkImageInfo imageInfo() const
void skew(SkScalar sx, SkScalar sy)
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
void setSubpixel(bool subpixel)
void setTypeface(sk_sp< SkTypeface > tf)
void setSize(SkScalar textSize)
@ kAntiAlias
may have transparent pixels on glyph edges
@ kAlias
no transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
@ kUseDeviceIndependentFonts_Flag
SkPixelGeometry pixelGeometry() const
static sk_sp< SkTextBlob > MakeFromPosText(const void *text, size_t byteLength, const SkPoint pos[], const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
sk_sp< SkColorSpace > refColorSpace() const
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)