Flutter Engine
The Flutter Engine
Path_ConvertConicToQuads.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(Path_ConvertConicToQuads, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 SkPaint conicPaint;
7 conicPaint.setAntiAlias(true);
9 SkPaint quadPaint(conicPaint);
10 quadPaint.setColor(SK_ColorRED);
11 SkPoint conic[] = { {20, 170}, {80, 170}, {80, 230} };
12 for (auto weight : { .25f, .5f, .707f, .85f, 1.f } ) {
13 SkPoint quads[5];
14 SkPath::ConvertConicToQuads(conic[0], conic[1], conic[2], weight, quads, 1);
16 path.moveTo(conic[0]);
17 path.conicTo(conic[1], conic[2], weight);
18 canvas->drawPath(path, conicPaint);
19 path.rewind();
20 path.moveTo(quads[0]);
21 path.quadTo(quads[1], quads[2]);
22 path.quadTo(quads[3], quads[4]);
23 canvas->drawPath(path, quadPaint);
24 canvas->translate(50, -50);
25 }
26}
27} // END FIDDLE
REG_FIDDLE(Path_ConvertConicToQuads, 256, 256, false, 0)
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
static int ConvertConicToQuads(const SkPoint &p0, const SkPoint &p1, const SkPoint &p2, SkScalar w, SkPoint pts[], int pow2)
Definition: SkPath.cpp:3238
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
AI float conic(float tolerance, const SkPoint pts[], float w, const VectorXform &vectorXform=VectorXform())
Definition: WangsFormula.h:287