2019-03-15 18:22:51 +00:00
|
|
|
// Copyright 2019 Google LLC.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/fiddle/examples.h"
|
2019-03-15 18:22:51 +00:00
|
|
|
// HASH=7d3751e82d1b6ec328ffa3d6f48ca831
|
2019-03-18 20:06:34 +00:00
|
|
|
REG_FIDDLE(Canvas_saveLayer_3, 256, 256, false, 3) {
|
2019-03-15 18:22:51 +00:00
|
|
|
void draw(SkCanvas* canvas) {
|
|
|
|
// sk_sp<SkImage> image = GetResourceAsImage("images/mandrill_256.png");
|
2021-01-28 16:20:41 +00:00
|
|
|
canvas->drawImage(image, 0, 0);
|
2019-03-15 18:22:51 +00:00
|
|
|
SkCanvas::SaveLayerRec rec;
|
|
|
|
SkPaint paint;
|
|
|
|
paint.setBlendMode(SkBlendMode::kPlus);
|
|
|
|
rec.fSaveLayerFlags = SkCanvas::kInitWithPrevious_SaveLayerFlag;
|
|
|
|
rec.fPaint = &paint;
|
|
|
|
canvas->saveLayer(rec);
|
|
|
|
paint.setBlendMode(SkBlendMode::kClear);
|
|
|
|
canvas->drawCircle(128, 128, 96, paint);
|
|
|
|
canvas->restore();
|
|
|
|
}
|
|
|
|
} // END FIDDLE
|