Flutter Engine
The Flutter Engine
draw_patch.cpp
Go to the documentation of this file.
1// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(draw_patch, 350, 350, false, 6) {
5// draw_patch
6void draw(SkCanvas* canvas) {
7 canvas->clear(SK_ColorWHITE);
9 p.setAntiAlias(true);
12 const SkPoint pts[] = {{100.f / 4.f, 0.f}, {3.f * 100.f / 4.f, 100.f}};
13 p.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
15 const SkPoint cubics[] = {{100, 100}, {150, 50}, {250, 150}, {300, 100},
16 {250, 150}, {350, 250}, {300, 300}, {250, 250},
17 {150, 350}, {100, 300}, {50, 250}, {150, 150}};
18 const SkPoint texCoords[] = {
19 {0.0f, 0.0f}, {100.0f, 0.0f}, {100.0f, 100.0f}, {0.0f, 100.0f}};
20 canvas->drawPatch(cubics, nullptr, texCoords, SkBlendMode::kSrcOver, p);
21}
22} // END FIDDLE
@ kSrcOver
r = s + (1-sa)*d
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
constexpr SkColor SK_ColorMAGENTA
Definition: SkColor.h:147
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorCYAN
Definition: SkColor.h:143
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode mode, const SkPaint &paint)
Definition: SkCanvas.cpp:2529
void clear(SkColor color)
Definition: SkCanvas.h:1199
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)
REG_FIDDLE(draw_patch, 350, 350, false, 6)
Definition: draw_patch.cpp:4
static void draw_patch(SkCanvas *canvas, SkImage *, const SkRect &r, sk_sp< SkImageFilter > imf)
PODArray< SkColor > colors
Definition: SkRecords.h:276
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
Definition: switches.h:259