Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Canvas_drawVertices_2.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4// HASH=e8bdae9bea3227758989028424fcac3d
5REG_FIDDLE(Canvas_drawVertices_2, 256, 256, false, 0) {
6void draw(SkCanvas* canvas) {
8 SkPoint points[] = { { 0, 0 }, { 250, 0 }, { 100, 100 }, { 0, 250 } };
9 SkPoint texs[] = { { 0, 0 }, { 0, 250 }, { 250, 250 }, { 250, 0 } };
11 paint.setShader(SkGradientShader::MakeLinear(points, colors, nullptr, 4, SkTileMode::kClamp));
13 std::size(points), points, texs, colors);
14 canvas->drawVertices(vertices, SkBlendMode::kDarken, paint);
15}
16} // END FIDDLE
static const int points[]
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
constexpr SkColor SK_ColorYELLOW
Definition SkColor.h:139
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
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawVertices(const SkVertices *vertices, SkBlendMode mode, const SkPaint &paint)
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)
static sk_sp< SkVertices > MakeCopy(VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
@ kTriangleFan_VertexMode
Definition SkVertices.h:33
const Paint & paint
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60