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

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_drawRRect, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_drawRRect  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file Canvas_drawRRect.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 paint.setAntiAlias(true);
8 SkRect outer = {30, 40, 210, 220};
9 SkRect radii = {30, 50, 70, 90 };
10 SkRRect rRect;
11 rRect.setNinePatch(outer, radii.fLeft, radii.fTop, radii.fRight, radii.fBottom);
12 canvas->drawRRect(rRect, paint);
13 paint.setColor(SK_ColorWHITE);
14 canvas->drawLine(outer.fLeft + radii.fLeft, outer.fTop,
15 outer.fLeft + radii.fLeft, outer.fBottom, paint);
16 canvas->drawLine(outer.fRight - radii.fRight, outer.fTop,
17 outer.fRight - radii.fRight, outer.fBottom, paint);
18 canvas->drawLine(outer.fLeft, outer.fTop + radii.fTop,
19 outer.fRight, outer.fTop + radii.fTop, paint);
20 canvas->drawLine(outer.fLeft, outer.fBottom - radii.fBottom,
21 outer.fRight, outer.fBottom - radii.fBottom, paint);
22}
23} // END FIDDLE
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
Definition: SkCanvas.cpp:2700
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
Definition: SkCanvas.cpp:1705
void setNinePatch(const SkRect &rect, SkScalar leftRad, SkScalar topRad, SkScalar rightRad, SkScalar bottomRad)
Definition: SkRRect.cpp:115
const Paint & paint
Definition: color_source.cc:38
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15