31 const unsigned twoColor = 0x807F1f1f;
55 paint->setAntiAlias(
true);
67 for (
int oneFill = 0; oneFill <= 1; ++oneFill) {
70 for (
int twoFill = 0; twoFill <= 1; ++twoFill) {
77 two.setFillType(twoF);
78 two.addRect(40, 40, 100, 100);
83 canvas->
drawPath(one, fOutlinePaint);
85 canvas->
drawPath(two, fOutlinePaint);
109 using INHERITED =
GM;
114DEF_GM(
return new PathOpsInverseGM; )
122 const char* svgStr[] = {
123 "M474.889 27.0952C474.889 27.1002 474.888 27.1018 474.889 27.1004L479.872 27.5019C479.883 27.3656 479.889 27.2299 479.889 27.0952L474.889 27.0952L474.889 27.0952Z",
124 "M474.94 26.9405C474.93 26.9482 474.917 26.9576 474.901 26.9683L477.689 31.1186C477.789 31.0512 477.888 30.9804 477.985 30.9059L474.94 26.9405L474.94 26.9405Z"
127 SkPath path[2], resultPath;
130 for (
int i = 0; i < 2; i++)
136 builder.resolve(&resultPath);
138 auto r = path[0].getBounds();
139 canvas->translate(30, 30);
140 canvas->scale(200 / r.width(), 200 / r.width());
141 canvas->translate(-r.fLeft, -r.fTop);
145 paint.setAntiAlias(
true);
147 paint.setStrokeWidth(0);
149 canvas->drawPath(path[0],
paint);
150 canvas->drawPath(path[1],
paint);
154 canvas->drawPath(resultPath,
paint);
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
@ kReverseDifference_SkPathOp
subtract the first path from the op path
@ kDifference_SkPathOp
subtract the op path from the first path
@ kIntersect_SkPathOp
intersect the two paths
@ kUnion_SkPathOp
union (inclusive-or) the two paths
@ kXOR_SkPathOp
exclusive-or the two paths
void allocN32Pixels(int width, int height, bool isOpaque=false)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawPath(const SkPath &path, const SkPaint &paint)
void setStyle(Style style)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
static bool FromSVGString(const char str[], SkPath *)
void setFillType(SkPathFillType ft)
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
SkString getName() const override
void makePaint(SkPaint *paint, SkColor color)
void onOnceBeforeDraw() override
SkColor blend(SkColor one, SkColor two)
SkISize getISize() override
void onDraw(SkCanvas *canvas) override
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeWH(float w, float h)