Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkPath_quadTo_example.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (SkPath_quadTo_example, 512, 512, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( SkPath_quadTo_example  ,
512  ,
512  ,
false  ,
 
)

Definition at line 4 of file SkPath_quadTo_example.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 canvas->clear(SkColorSetARGB(255, 255, 255, 255));
7
9 paint.setAntiAlias(true);
11 paint.setStrokeWidth(5);
12
13 SkPoint a{100, 100};
14 SkPoint b{200, 400};
15 SkPoint c{300, 100};
16
17 SkPath twoSegments;
18 twoSegments.moveTo(a);
19 twoSegments.lineTo(b);
20 twoSegments.lineTo(c);
21
22 canvas->drawPath(twoSegments, paint);
23
24 paint.setColor(SkColorSetARGB(255, 0, 0, 255));
25 SkPath quadraticCurve;
26 quadraticCurve.moveTo(a);
27 quadraticCurve.quadTo(b, c);
28 canvas->drawPath(quadraticCurve, paint);
29
30 SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 32);
31 SkPaint textPaint;
32 textPaint.setAntiAlias(true);
33 canvas->drawString("a", a.x(), a.y(), font, textPaint);
34 canvas->drawString("b", b.x() + 20, b.y() + 20, font, textPaint);
35 canvas->drawString("c", c.x(), c.y(), font, textPaint);
36}
37} // END FIDDLE
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition SkColor.h:49
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void clear(SkColor color)
Definition SkCanvas.h:1199
void drawPath(const SkPath &path, const SkPaint &paint)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition SkCanvas.h:1803
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
void setAntiAlias(bool aa)
Definition SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
SkPath & moveTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:678
SkPath & lineTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:718
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition SkPath.cpp:736
const Paint & paint
sk_sp< SkFontMgr > fontMgr
Definition examples.cpp:32
static bool b
struct MyStruct a[10]
font
Font Metadata and Metrics.