26 path.setFillType(fill);
28 paint.setStrokeCap(cap);
30 paint.setStrokeJoin(join);
32 paint.setStyle(style);
44 constexpr FillAndName gFills[] = {
54 constexpr StyleAndName
gStyles[] = {
64 constexpr CapAndName gCaps[] = {
78 path.fName =
"moveTo-line-close";
80 path.fName =
"moveTo-line";
89 const char titleNoClose[] =
"Line Drawn Into Rectangle Clips With "
90 "Indicated Style, Fill and Linecaps, with stroke width 10";
91 const char titleClose[] =
"Line Closed Drawn Into Rectangle Clips With "
92 "Indicated Style, Fill and Linecaps, with stroke width 10";
93 const char* title = doClose ? titleClose : titleNoClose;
94 canvas->
drawString(title, 20.0f, 20.0f, font, titlePaint);
101 for (
size_t cap = 0; cap < std::size(gCaps); ++cap) {
106 for (
size_t fill = 0; fill < std::size(gFills); ++fill) {
111 for (
size_t style = 0; style < std::size(
gStyles); ++style) {
118 gCaps[cap].fCap, gCaps[cap].fJoin,
gStyles[style].fStyle,
SkStrokeRec::Style fStyle
static const int strokeWidth
constexpr SkColor SK_ColorBLACK
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void drawPath(const SkPath &path, const SkPaint &paint)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
@ kButt_Cap
no stroke extension
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
@ kStrokeAndFill_Style
sets to stroke and fill geometry
@ kBevel_Join
connects outside edges
void setStrokeWidth(SkScalar width)
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
static void draw(SkCanvas *canvas, bool doClose)
static void drawPath(SkPath &path, SkCanvas *canvas, SkColor color, const SkRect &clip, SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPathFillType fill, SkScalar strokeWidth)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkFontStyle gStyles[]