Flutter Engine
The Flutter Engine
skpaint_line_2d_path_effect.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(skpaint_line_2d_path_effect, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
7 SkMatrix lattice;
8 lattice.setScale(8.0f, 8.0f);
9 lattice.preRotate(30.0f);
10 paint.setPathEffect(SkLine2DPathEffect::Make(0.0f, lattice));
11 paint.setAntiAlias(true);
12 SkRect bounds = SkRect::MakeWH(256, 256);
13 bounds.outset(8.0f, 8.0f);
14 canvas->clear(SK_ColorWHITE);
15 canvas->drawRect(bounds, paint);
16}
17} // END FIDDLE
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
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 clear(SkColor color)
Definition: SkCanvas.h:1199
static sk_sp< SkPathEffect > Make(SkScalar width, const SkMatrix &matrix)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:296
SkMatrix & preRotate(SkScalar degrees, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:462
const Paint & paint
Definition: color_source.cc:38
Optional< SkRect > bounds
Definition: SkRecords.h:189
REG_FIDDLE(skpaint_line_2d_path_effect, 256, 256, false, 0)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609