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
41
void draw(SkCanvas* canvas) {
SkPaint paint1;
SkPaint paint2;
float width = 120.0f;
float height = 90.0f;
float cw = 15.0f;
float ch = 15.0f;
SkMatrix lattice1;
lattice1.setScale(cw, ch);
lattice1.preRotate(0.0f);
lattice1.preTranslate(-cw, 0.0f);
SkMatrix lattice2;
lattice2.setScale(cw, ch);
lattice2.preRotate(90.0f);
lattice2.preTranslate(0.0f, -ch);
canvas->clear(SK_ColorWHITE);
paint1.setAntiAlias(false);
paint1.setPathEffect(SkLine2DPathEffect::Make(1.0f, lattice1));
SkRect bounds1 = SkRect::MakeXYWH(cw, -ch, width, height);
paint2.setAntiAlias(false);
paint2.setPathEffect(SkLine2DPathEffect::Make(1.0f, lattice2));
SkRect bounds2 = SkRect::MakeXYWH(-cw, ch, width, height);
canvas->drawRect(bounds1, paint1);
canvas->drawRect(bounds2, paint2);
SkPaint strokePaint;
strokePaint.setAntiAlias(false);
strokePaint.setStrokeWidth(1.0f);
strokePaint.setColor(SkColorSetARGB(0xFF, 0xFF, 0x00, 0x00));
strokePaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(SkRect::MakeXYWH(0.0f, 0.0f, width, height), strokePaint);
}