34#include <initializer_list>
40 const int w = tileW *
m;
41 const int h = tileH * n;
44 surf->getCanvas()->clear(
bgColor);
46 static constexpr SkScalar kStripeW = 10;
47 static constexpr SkScalar kStripeSpacing = 30;
52 paint.setShader(std::move(grad));
53 paint.setAntiAlias(
true);
55 paint.setStrokeWidth(kStripeW);
56 SkPoint stripePts[] = {{-
w - kStripeW, -kStripeW}, {kStripeW,
h + kStripeW}};
57 while (stripePts[0].fX <=
w) {
59 stripePts[0].
fX += kStripeSpacing;
60 stripePts[1].
fX += kStripeSpacing;
65 paint.setShader(std::move(grad));
67 stripePts[0] = {-
w - kStripeW,
h + kStripeW};
68 stripePts[1] = {kStripeW, -kStripeW};
69 while (stripePts[0].fX <=
w) {
71 stripePts[0].
fX += kStripeSpacing;
72 stripePts[1].
fX += kStripeSpacing;
74 auto fullImage = surf->makeImageSnapshot();
75 for (
int y = 0;
y < n; ++
y) {
76 for (
int x = 0;
x <
m; ++
x) {
96 set[
y *
m +
x].fImage = fullImage->makeSubset(
nullptr, subset);
100 set[
y *
m +
x].fAlpha = 1.f;
111 SkISize getISize()
override {
return {1000, 725}; }
112 void onOnceBeforeDraw()
override {
118 void onDraw(
SkCanvas* canvas)
override {
128 {kM * kTileW + 10.f, -5.f},
129 {kM * kTileW - 28.f, kN * kTileH + 40.f},
130 {45.f, kN * kTileH - 25.f}};
139 dst[1] = {-.25 * kM * kTileW, 0};
140 dst[0] = {5.f / 4.f * kM * kTileW, 0};
141 dst[3] = {2.f / 3.f * kM * kTileW, 1 / 2.f * kN * kTileH};
142 dst[2] = {1.f / 3.f * kM * kTileW, 1 / 2.f * kN * kTileH - 0.1f * kTileH};
152 static constexpr SkScalar kLineOutset = 10.f;
154 paint.setAntiAlias(
true);
157 paint.setStrokeWidth(0.f);
158 for (
int x = 1;
x < kM; ++
x) {
159 SkPoint pts[] = {{
x * kTileW, 0}, {
x * kTileW, kN * kTileH}};
165 for (
int y = 1;
y < kN; ++
y) {
166 SkPoint pts[] = {{0,
y * kTileH}, {kTileW * kM,
y * kTileH}};
202 inline static constexpr int kM = 4;
203 inline static constexpr int kN = 3;
204 inline static constexpr SkScalar kTileW = 30;
205 inline static constexpr SkScalar kTileH = 60;
213 SkString getName()
const override {
return SkString(
"draw_image_set_rect_to_rect"); }
214 SkISize getISize()
override {
return {1250, 850}; }
215 void onOnceBeforeDraw()
override {
221 void onDraw(
SkCanvas* canvas)
override {
266 std::copy_n(fSet, kM * kN, scaledSet);
267 for (
int i = 0;
i < kM * kN; ++
i) {
272 scaledSet[
i].
fAlpha = 0 == (
i % 3) ? 0.4f : 1.f;
288 inline static constexpr int kM = 2;
289 inline static constexpr int kN = 2;
290 inline static constexpr int kTileW = 40;
291 inline static constexpr int kTileH = 50;
298 SkString getName()
const override {
return SkString(
"draw_image_set_alpha_only"); }
299 SkISize getISize()
override {
return {kM * kTileW, 2 * kN * kTileH}; }
303#if defined(SK_GRAPHITE)
314 for (
int y = 0;
y < kN; ++
y) {
315 for (
int x = 0;
x < kM; ++
x) {
317 fSet[
i].
fAlpha = (kM -
x) / (
float) kM;
319#if defined(SK_GRAPHITE)
335 void onDraw(
SkCanvas* canvas)
override {
340 paint.setColor4f({0.2f, 0.8f, 0.4f, 1.f});
350 for (
int y = 0;
y < kN; ++
y) {
351 for (
int x = 0;
x < kM; ++
x) {
357 fSet[
i].fSrcRect, fSet[
i].fDstRect,
364 inline static constexpr int kM = 4;
365 inline static constexpr int kN = 4;
366 inline static constexpr int kTileW = 50;
367 inline static constexpr int kTileH = 50;
static const SkColor bgColor
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kSrcOver
r = s + (1-sa)*d
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorLTGRAY
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
constexpr SkColor SK_ColorDKGRAY
sk_sp< T > sk_ref_sp(T *obj)
constexpr SkColor kBGColor
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
virtual skgpu::graphite::Recorder * recorder() const
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
@ kFast_SrcRectConstraint
sample outside bounds; faster
void experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt, const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkSamplingOptions &, const SkPaint *paint=nullptr, SrcRectConstraint constraint=kStrict_SrcRectConstraint)
void rotate(SkScalar degrees)
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void concat(const SkMatrix &matrix)
@ kLines_PointMode
draw each pair of points as a line segment
static sk_sp< SkColorFilter > LinearToSRGBGamma()
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
virtual sk_sp< SkImage > makeColorTypeAndColorSpace(GrDirectContext *direct, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const =0
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
SkMatrix & postRotate(SkScalar degrees, SkScalar px, SkScalar py)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & postSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
@ kStroke_Style
set to stroke geometry
void setBlendMode(SkBlendMode mode)
void setColorFilter(sk_sp< SkColorFilter > colorFilter)
static void make_image_tiles(int tileW, int tileH, int m, int n, const SkColor colors[4], SkCanvas::ImageSetEntry set[], const SkColor bgColor=SK_ColorLTGRAY)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static float max(float r, float g, float b)
PODArray< SkColor > colors
SkSamplingOptions sampling
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
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
static SkPath scale(const SkPath &path, SkScalar scale)
SkSamplingOptions(SkFilterMode::kLinear))
sk_sp< const SkImage > fImage
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
bool setLength(float length)
SkScalar fBottom
larger y-axis bounds
void toQuad(SkPoint quad[4]) const
constexpr SkRect makeOffset(float dx, float dy) const
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkRect makeInset(float dx, float dy) const
SkScalar fRight
larger x-axis bounds
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
SkScalar fTop
smaller y-axis bounds