Options
These globals are now defined:
double duration; // The requested duration of the animation. double frame; // A value in [0, 1] of where we are in the animation.
This global is now defined:
GrBackendRenderTarget backEndRenderTarget;
GrBackendTexture backEndTextureRenderTarget;
Optional source image
These globals are now defined:
SkBitmap source; sk_sp<SkImage> image; GrBackendTexture backEndTexture; // GPU Only.
Note:
Adding comments with SK_FOLD_START and SK_FOLD_END creates foldable code
blocks.
These blocks will be folded by default and are useful for highlighting specific lines of code.
You can also use the keyboard shortcuts Ctrl+S and Ctrl+E in the code editor to set them.
These blocks will be folded by default and are useful for highlighting specific lines of code.
You can also use the keyboard shortcuts Ctrl+S and Ctrl+E in the code editor to set them.
xxxxxxxxxx
84
void draw(SkCanvas* canvas) {
SkPaint p;
p.setColor(SK_ColorRED);
p.setAntiAlias(true);
p.setStyle(SkPaint::kFill_Style);
p.setStrokeWidth(10);
SkPath path;
path.setFillType(SkPathFillType::kWinding);
path.setFillType(SkPathFillType::kWinding);
path.moveTo(375, -30);
path.cubicTo(578, -30, 749, 176, 749, 422);
path.cubicTo(749, 583, 666, 706, 518, 765);
path.lineTo(163, 611);
path.lineTo(163, 579);
path.lineTo(405, 684);
path.cubicTo(551, 609, 645, 468, 645, 322);
path.cubicTo(645, 183, 563, 82, 450, 82);
path.cubicTo(303, 82, 179, 249, 179, 446);
path.cubicTo(179, 579, 235, 689, 341, 768);
path.lineTo(327, 786);
path.cubicTo(165, 717, 56, 536, 56, 335);
path.cubicTo(56, 125, 192, -30, 375, -30);
path.close();
path.moveTo(214, 225);
path.cubicTo(333, 248, 396, 311, 396, 405);
path.lineTo(396, 695);
path.lineTo(267, 641);
path.lineTo(267, 395);
path.cubicTo(267, 324, 249, 285, 201, 254);
path.cubicTo(201, 254, 214, 225, 214, 225);
path.close();
path.moveTo(682, -106);
path.lineTo(832, 12);
path.lineTo(813, 33);
path.lineTo(772, 0);
path.cubicTo(716, 29, 668, 76, 628, 140);
path.lineTo(527, 44);
path.cubicTo(575, -26, 628, -77, 682, -106);
path.close();
path.moveTo(450, 59);
path.lineTo(480, 59);
path.lineTo(480, 678);
path.lineTo(450, 678);
path.cubicTo(450, 678, 450, 59, 450, 59);
path.close();
path.moveTo(463, 374);
path.lineTo(633, 459);
path.lineTo(633, 490);
path.lineTo(463, 406);
path.cubicTo(463, 406, 463, 374, 463, 374);
path.close();
path.moveTo(463, 269);
path.lineTo(667, 372);
path.lineTo(667, 403);
path.lineTo(463, 301);
path.cubicTo(463, 301, 463, 269, 463, 269);
path.close();
SkPath path2;
path2.setFillType(SkPathFillType::kWinding);
path2.moveTo(492.041f, 525.339f);
path2.cubicTo(492.041f, 521.624f, 490.727f, 518.453f, 488.1f, 515.826f);
path2.cubicTo(485.473f, 513.199f, 482.302f, 511.886f, 478.587f, 511.886f);
path2.cubicTo(474.872f, 511.886f, 471.701f, 513.199f, 469.074f, 515.826f);
path2.cubicTo(466.447f, 518.453f, 465.134f, 521.624f, 465.134f, 525.339f);
path2.cubicTo(465.134f, 529.054f, 466.447f, 532.226f, 469.074f, 534.853f);
path2.cubicTo(471.701f, 537.479f, 474.872f, 538.793f, 478.587f, 538.793f);
path2.cubicTo(482.302f, 538.793f, 485.473f, 537.479f, 488.1f, 534.853f);
path2.cubicTo(490.727f, 532.226f, 492.041f, 529.054f, 492.041f, 525.339f);
path2.close();
SkPath opResult;
Op(path, path2, kDifference_SkPathOp, &opResult);
// This produces the correct result in all the cases I've tried.
// So it appears to be a winding issue.
//canvas->drawPath(opResult, p);
SkPath winding;
path2.setFillType(SkPathFillType::kWinding);
AsWinding(opResult, &winding);
canvas->drawPath(winding, p);
}