Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
docs
examples
Path_addRect_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.
3
#include "
tools/fiddle/examples.h
"
4
// HASH=9202430b3f4f5275af8eec5cc9d7baa8
5
REG_FIDDLE
(Path_addRect_2, 256, 128,
false
, 0) {
6
void
draw
(
SkCanvas
* canvas) {
7
const
SkPoint
arrow[] = { {5, -5}, {15, -5}, {20, 0}, {15, 5}, {5, 5}, {10, 0} };
8
const
SkRect
rect = {10, 10, 54, 54};
9
SkPaint
rectPaint;
10
rectPaint.
setAntiAlias
(
true
);
11
rectPaint.
setStyle
(
SkPaint::kStroke_Style
);
12
SkPaint
arrowPaint(rectPaint);
13
SkPath
arrowPath;
14
arrowPath.
addPoly
(arrow, std::size(arrow),
true
);
15
arrowPaint.
setPathEffect
(
SkPath1DPathEffect::Make
(arrowPath, 176, 0,
16
SkPath1DPathEffect::kRotate_Style
));
17
for
(
auto
direction : {
SkPathDirection::kCW
,
SkPathDirection::kCCW
} ) {
18
for
(
unsigned
start
: { 0, 1, 2, 3 } ) {
19
SkPath
path;
20
path.addRect(rect, direction,
start
);
21
canvas->
drawPath
(path, rectPaint);
22
canvas->
drawPath
(path, arrowPaint);
23
canvas->
translate
(64, 0);
24
}
25
canvas->
translate
(-256, 64);
26
}
27
}
28
}
// END FIDDLE
SkPathDirection::kCCW
@ kCCW
SkPathDirection::kCW
@ kCW
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition
aaclip.cpp:27
SkCanvas
Definition
SkCanvas.h:106
SkCanvas::translate
void translate(SkScalar dx, SkScalar dy)
Definition
SkCanvas.cpp:1602
SkCanvas::drawPath
void drawPath(const SkPath &path, const SkPaint &paint)
Definition
SkCanvas.cpp:2071
SkPaint
Definition
SkPaint.h:44
SkPaint::setStyle
void setStyle(Style style)
Definition
SkPaint.cpp:105
SkPaint::setAntiAlias
void setAntiAlias(bool aa)
Definition
SkPaint.h:170
SkPaint::kStroke_Style
@ kStroke_Style
set to stroke geometry
Definition
SkPaint.h:194
SkPaint::setPathEffect
void setPathEffect(sk_sp< SkPathEffect > pathEffect)
SkPath1DPathEffect::Make
static sk_sp< SkPathEffect > Make(const SkPath &path, SkScalar advance, SkScalar phase, Style)
Definition
Sk1DPathEffect.cpp:250
SkPath1DPathEffect::kRotate_Style
@ kRotate_Style
Definition
Sk1DPathEffect.h:22
SkPath
Definition
SkPath.h:59
SkPath::addPoly
SkPath & addPoly(const SkPoint pts[], int count, bool close)
Definition
SkPath.cpp:880
examples.h
REG_FIDDLE
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition
examples.h:60
start
glong start
Definition
fl_accessible_text_field.cc:39
SkPoint
Definition
SkPoint_impl.h:163
SkRect
Definition
extension.cpp:13
Generated on Fri Apr 26 2024 06:15:46 for Flutter Engine by
1.9.8