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

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_drawDrawable_2, 256, 100, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_drawDrawable_2  ,
256  ,
100  ,
false  ,
 
)

Definition at line 4 of file Canvas_drawDrawable_2.cpp.

4 {
5struct MyDrawable : public SkDrawable {
6 SkRect onGetBounds() override { return SkRect::MakeWH(50, 100); }
7 void onDraw(SkCanvas* canvas) override {
9 path.conicTo(10, 90, 50, 90, 0.9f);
11 paint.setColor(SK_ColorBLUE);
12 canvas->drawRect(path.getBounds(), paint);
13 paint.setAntiAlias(true);
14 paint.setColor(SK_ColorWHITE);
15 canvas->drawPath(path, paint);
16 }
17};
18
19void draw(SkCanvas* canvas) {
20 sk_sp<SkDrawable> drawable(new MyDrawable);
21 canvas->drawDrawable(drawable.get(), 10, 10);
22}
23} // END FIDDLE
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
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 drawDrawable(SkDrawable *drawable, const SkMatrix *matrix=nullptr)
Definition: SkCanvas.cpp:2574
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
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
void onDraw(SkCanvas *canvas) override
Definition: drawable.cpp:21
SkRect onGetBounds() override
Definition: drawable.cpp:19
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609