Flutter Engine
The Flutter Engine
Paint_setShader.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.
4REG_FIDDLE(Paint_setShader, 256, 64, false, 0) {
5void draw(SkCanvas* canvas) {
7 paint.setColor(SK_ColorBLUE);
9 canvas->drawRect(SkRect::MakeWH(40, 40), paint);
10 paint.setShader(nullptr);
11 canvas->translate(50, 0);
12 canvas->drawRect(SkRect::MakeWH(40, 40), paint);
13}
14} // END FIDDLE
REG_FIDDLE(Paint_setShader, 256, 64, false, 0)
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 drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
const Paint & paint
Definition: color_source.cc:38
SK_API sk_sp< SkShader > Color(SkColor)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609