1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC.
2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h"
4cb93a386Sopenharmony_ci// HASH=accb545d67984ced168f5be6ab824795
5cb93a386Sopenharmony_ciREG_FIDDLE(Canvas_drawPatch, 256, 256, false, 5) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    // SkBitmap source = cmbkygk;
8cb93a386Sopenharmony_ci    SkPaint paint;
9cb93a386Sopenharmony_ci    paint.setAntiAlias(true);
10cb93a386Sopenharmony_ci    SkPoint cubics[] = { { 3, 1 },    { 4, 2 }, { 5, 1 },    { 7, 3 },
11cb93a386Sopenharmony_ci                      /* { 7, 3 }, */ { 6, 4 }, { 7, 5 },    { 5, 7 },
12cb93a386Sopenharmony_ci                      /* { 5, 7 }, */ { 4, 6 }, { 3, 7 },    { 1, 5 },
13cb93a386Sopenharmony_ci                      /* { 1, 5 }, */ { 2, 4 }, { 1, 3 }, /* { 3, 1 } */ };
14cb93a386Sopenharmony_ci    SkColor colors[] = { 0xbfff0000, 0xbf0000ff, 0xbfff00ff, 0xbf00ffff };
15cb93a386Sopenharmony_ci    SkPoint texCoords[] = { { -30, -30 }, { 162, -30}, { 162, 162}, { -30, 162} };
16cb93a386Sopenharmony_ci    paint.setShader(source.makeShader(SkSamplingOptions(SkFilterMode::kLinear)));
17cb93a386Sopenharmony_ci    canvas->scale(15, 15);
18cb93a386Sopenharmony_ci    for (auto blend : { SkBlendMode::kSrcOver, SkBlendMode::kModulate, SkBlendMode::kXor } ) {
19cb93a386Sopenharmony_ci        canvas->drawPatch(cubics, colors, texCoords, blend, paint);
20cb93a386Sopenharmony_ci        canvas->translate(4, 4);
21cb93a386Sopenharmony_ci    }
22cb93a386Sopenharmony_ci}
23cb93a386Sopenharmony_ci}  // END FIDDLE
24