1 // Copyright 2019 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 // HASH=7d3751e82d1b6ec328ffa3d6f48ca831
5 REG_FIDDLE(Canvas_saveLayer_3, 256, 256, false, 3) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7 // sk_sp<SkImage> image = GetResourceAsImage("images/mandrill_256.png");
8 canvas->drawImage(image, 0, 0, nullptr);
9 SkCanvas::SaveLayerRec rec;
10 SkPaint paint;
11 paint.setBlendMode(SkBlendMode::kPlus);
12 rec.fSaveLayerFlags = SkCanvas::kInitWithPrevious_SaveLayerFlag;
13 rec.fPaint = &paint;
14 canvas->saveLayer(rec);
15 paint.setBlendMode(SkBlendMode::kClear);
16 canvas->drawCircle(128, 128, 96, paint);
17 canvas->restore();
18 }
19 } // END FIDDLE
20