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
40
// If pathops works, nearly all of this should appear overdrawn in Blue
// If pathops fails, it will just appear in Red
void draw(SkCanvas* canvas) {
const char* svgStr[] = {
"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",
"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"
};
SkPath path[2], resultPath;
SkOpBuilder builder;
for (int i = 0; i < 2; i++)
{
SkParsePath::FromSVGString(svgStr[i], &path[i]);
builder.add(path[i], kUnion_SkPathOp);
}
builder.resolve(&resultPath);
SkString outSvg;
SkParsePath::ToSVGString(resultPath, &outSvg);
SkDebugf(outSvg.c_str());
auto r = path[0].getBounds();
canvas->translate(30, 30);
canvas->scale(200 / r.width(), 200 / r.width());
canvas->translate(-r.fLeft, -r.fTop);
SkPaint paint;
paint.setColor(SK_ColorRED);
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(0);
canvas->drawPath(path[0], paint);
canvas->drawPath(path[1], paint);
paint.setColor(SK_ColorBLUE);
canvas->drawPath(resultPath, paint);
}