This function was used to create the images used by these test. It saves them as PNGs (so they are lossless). Then the following bash script was used to create the oriented JPGs with imagemagick and exiftool: #!/bin/bash
for s in 444 422 420 440 411 410; do for i in {1..8}; do magick convert $i.png -sampling-factor ${s:0:1}:${s:1:1}:${s:2:1} $i_$s.jpg; exiftool -orientation=$i -n -m -overwrite_original $i_$s.jpg; done done
42 {
43 for (
int i = 1;
i <= 8; ++
i) {
46
47
48
50
53 }
57 auto* canvas = surf->getCanvas();
76
81
83 canvas->save();
84 canvas->translate(1, 1);
85 canvas->drawString(
string,
x,
y,
font, blurPaint);
86 canvas->restore();
88 };
89
90 auto measure = [&
font](
const char*
text) {
94 };
95
98
101
102 bounds = measure(
"bottom");
104
105
106
107 SkScalar baseY = midY - measure(
"leftright").centerY();
109 drawLabel(
"left",
kPad -
bounds.left(), baseY);
110
111 bounds = measure(
"right");
113
116 drawLabel(num.
c_str(), midX -
bounds.centerX(), baseY);
119 surf->makeImageSnapshot()->peekPixels(&pm);
121 }
122}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kNormal_SkBlurStyle
fuzzy inside and outside
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
@ kLeftTop_SkEncodedOrigin
static SkMatrix SkEncodedOriginToMatrix(SkEncodedOrigin origin, int w, int h)
@ kUTF8
uses bytes to represent UTF-8 or ASCII
void swap(sk_sp< T > &a, sk_sp< T > &b)
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
void setColor(SkColor color)
void setMaskFilter(sk_sp< SkMaskFilter > maskFilter)
void append(const char text[])
const char * c_str() const
Optional< SkRect > bounds
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
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.
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)