56 {
57 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
58 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
59
60
62#if defined(SK_GRAPHITE)
63 auto recorder = inputCanvas->
recorder();
64#endif
68 }
76#if defined(SK_GRAPHITE)
77 if (recorder) {
79 } else
80#endif
81 {
83 }
85
87
88 canvas->
scale(1.05f, 1.05f);
89 canvas->
clear(0xffffffff);
90
92 paint.setAntiAlias(
true);
93
95 font.setSubpixel(
true);
96
97 const char*
text =
"Hamburgefons";
98 const size_t textLen = strlen(
text);
99
100
106 canvas->
scale(scales[
i], scales[
i]);
107 font.setSize(textSizes[
i]);
109 y +=
font.getMetrics(
nullptr)*scales[
i];
110 }
111
112
113 for (
size_t i = 0;
i < 5; ++
i) {
116
120 for (int ps = 6; ps <= 32; ps += 3) {
123 rotY +=
font.getMetrics(
nullptr);
124 }
125 }
126
127
132 for (
size_t i = 0;
i < arraySize; ++
i) {
136 canvas->
scale(scaleFactor, scaleFactor);
137 font.setSize(textSizes[
i]);
139 y +=
font.getMetrics(
nullptr)*scaleFactor;
140 }
141
142
143 {
145
146 canvas->
scale(2.0f, 2.0f);
147
151 font.setSize(textSizes[0]);
153
157 }
158
159
160
162 0xFFFFFFFF,
163 0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF,
164 0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
165 0xFF000000,
166 };
167
168 paint.setColor(0xFFF7F3F7);
171
177
179 y +=
font.getMetrics(
nullptr);
180 }
181
182 paint.setColor(0xFF181C18);
185
191
193 y +=
font.getMetrics(
nullptr);
194 }
195
196
197 {
200 canvas->
skew(0.0f, 0.151515f);
203 }
204 {
207 canvas->
skew(0.5f, 0.0f);
210 }
211
212
213 {
217 persp.
setAll(0.9839f, 0, 0,
218 0.2246f, 0.6829f, 0,
219 0.0002352f, -0.0003844f, 1);
224 }
225 {
226 font.setSubpixel(
false);
230 persp.
setAll(0.9839f, 0, 0,
231 0.2246f, 0.6829f, 0,
232 0.0002352f, -0.0003844f, 1);
235 canvas->
scale(375, 375);
238 }
239
240
249 670,
250 90,
251 emojiFont,
253 }
254
255
258
261 }
262 }
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
virtual skgpu::graphite::Recorder * recorder() const
virtual SkISize getBaseLayerSize() 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)