Flutter Engine
The Flutter Engine
Functions
skcanvas_paint.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (skcanvas_paint, 256, 256, false, 5)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( skcanvas_paint  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file skcanvas_paint.cpp.

4 {
5void draw(SkCanvas* canvas) {
7
10 paint.setStrokeWidth(4);
11 paint.setColor(SK_ColorRED);
12
13 SkRect rect = SkRect::MakeXYWH(50, 50, 40, 60);
14 canvas->drawRect(rect, paint);
15
17 oval.setOval(rect);
18 oval.offset(40, 60);
19 paint.setColor(SK_ColorBLUE);
20 canvas->drawRRect(oval, paint);
21
22 paint.setColor(SK_ColorCYAN);
23 canvas->drawCircle(180, 50, 25, paint);
24
25 rect.offset(80, 0);
26 paint.setColor(SK_ColorYELLOW);
27 canvas->drawRoundRect(rect, 10, 10, paint);
28
30 path.cubicTo(768, 0, -512, 256, 256, 256);
31 paint.setColor(SK_ColorGREEN);
32 canvas->drawPath(path, paint);
33
34 canvas->drawImage(image, 128, 128, SkSamplingOptions(), &paint);
35
36 SkRect rect2 = SkRect::MakeXYWH(0, 0, 40, 60);
37 canvas->drawImageRect(image, rect2, SkSamplingOptions(), &paint);
38
39 SkPaint paint2;
40 auto text = SkTextBlob::MakeFromString("Hello, Skia!", SkFont(nullptr, 18));
41 canvas->drawTextBlob(text.get(), 50, 25, paint2);
42}
43} // END FIDDLE
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
constexpr SkColor SK_ColorCYAN
Definition: SkColor.h:143
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
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 drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
Definition: SkCanvas.cpp:1705
void drawRoundRect(const SkRect &rect, SkScalar rx, SkScalar ry, const SkPaint &paint)
Definition: SkCanvas.cpp:2717
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
Definition: SkCanvas.cpp:2484
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
Definition: SkFont.h:35
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
static sk_sp< SkTextBlob > MakeFromString(const char *string, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
Definition: SkTextBlob.h:115
const Paint & paint
Definition: color_source.cc:38
std::u16string text
sk_sp< const SkImage > image
Definition: SkRecords.h:269
SkRect oval
Definition: SkRecords.h:249
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
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
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
void offset(float dx, float dy)
Definition: SkRect.h:1016