43 : fPaintStyle(paintStyle)
44 , fPathEffect(
std::move(pe)) {}
50 constexpr SkScalar kIntervals[] = { 4.f, 3.f };
77const SkScalar slideWidth = 90, slideHeight = 90;
83 SkScalar cx = slideWidth / 2 + slideBoundary;
84 SkScalar cy = slideHeight / 2 + slideBoundary;
85 SkScalar dx = slideWidth + 2 * slideBoundary;
86 SkScalar dy = slideHeight + 2 * slideBoundary;
89 slideBoundary + slideWidth,
90 slideBoundary + slideHeight);
100 for (
size_t styleIndex = 0; styleIndex < std::size(styles);
102 for (
size_t sizeIndex = 0; sizeIndex < std::size(pathSizes);
104 SkScalar size = pathSizes[sizeIndex];
108 for (
size_t widthIndex = 0;
109 widthIndex < std::size(strokeWidths);
112 paint.setColor(0xff007000);
113 paint.setStrokeWidth(strokeWidths[widthIndex]);
114 paint.setStyle(styles[styleIndex].fPaintStyle);
115 paint.setPathEffect(styles[styleIndex].fPathEffect);
117 for (
size_t pathIndex = 0;
118 pathIndex < std::size(paths);
120 canvas->drawRect(clipRect, clipPaint);
123 canvas->clipRect(clipRect);
125 SkPath path = paths[pathIndex](cx, cy, size);
127 canvas->drawPath(path,
paint);
130 canvas->drawPath(path, outlinePaint);
133 canvas->translate(dx, 0);
137 canvas->translate(0, dy);
148 canvas->clipRect({0, 0, 128, 128});
149 canvas->drawPath(path,
paint);
155 canvas->drawRect({0, 0, 128, 128}, stroke);
159 paint.setAntiAlias(
true);
163 canvas->translate(128, 0);
167 canvas->translate(128, 0);
168 paint.setImageFilter(
nullptr);
181 SkRect clipRect = {0, 0, 51, 99};
182 canvas->drawPath(path, strokePaint);
189 canvas->translate(51, 0);
191 canvas->clipRect(clipRect);
192 path.setFillType(fillType);
193 canvas->drawPath(path, fillPaint);
199 canvas->drawRect(clipRect, clipPaint);
static sk_sp< SkPathEffect > make_dash()
@ kNormal_SkBlurStyle
fuzzy inside and outside
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorWHITE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
void setStyle(Style style)
void setColor(SkColor color)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
@ kStrokeAndFill_Style
sets to stroke and fill geometry
void setMaskFilter(sk_sp< SkMaskFilter > maskFilter)
void setStrokeWidth(SkScalar width)
static SkPath Rect(const SkRect &, SkPathDirection=SkPathDirection::kCW, unsigned startIndex=0)
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
static SkPath Line(const SkPoint a, const SkPoint b)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
static SkPath generate_circle(SkScalar cx, SkScalar cy, SkScalar d)
static SkPath generate_line(SkScalar cx, SkScalar cy, SkScalar l)
static SkPath generate_square(SkScalar cx, SkScalar cy, SkScalar w)
static SkPath generate_rect_line(SkScalar cx, SkScalar cy, SkScalar l)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)