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
27
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
SkMatrix matrix;
const SkPoint center = {128, 103};
matrix.setScale(2, .5f, center.fX, center.fY);
matrix.postRotate(45, center.fX, center.fY);
const SkScalar circleRadius = 60;
SkScalar mappedRadius = matrix.mapRadius(circleRadius);
SkVector minorAxis = matrix.mapVector({0, circleRadius});
SkVector majorAxis = matrix.mapVector({circleRadius, 0});
paint.setColor(SK_ColorRED);
canvas->drawLine(40, 240, 40 + minorAxis.length(), 240, paint);
canvas->drawLine(42 + minorAxis.length(), 240, 42 + minorAxis.length() + majorAxis.length(),
240, paint);
paint.setColor(SK_ColorBLACK);
canvas->drawLine(center.fX, center.fY, center.fX + mappedRadius, center.fY, paint);
canvas->drawLine(center.fX, center.fY, center.fX, center.fY + mappedRadius, paint);
canvas->drawLine(40, 220, 40 + mappedRadius, 220, paint);
canvas->drawLine(42 + mappedRadius, 220, 42 + mappedRadius * 2, 220, paint);
canvas->concat(matrix);
canvas->drawCircle(center.fX, center.fY, circleRadius, paint);
paint.setColor(SK_ColorRED);
canvas->drawLine(center.fX, center.fY, center.fX + circleRadius, center.fY, paint);
canvas->drawLine(center.fX, center.fY, center.fX, center.fY + circleRadius, paint);
}