Flutter Engine
The Flutter Engine
Canvas_saveLayerAlpha.cpp
Go to the documentation of this file.
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.
4REG_FIDDLE(Canvas_saveLayerAlpha, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
7 paint.setColor(SK_ColorRED);
8 canvas->drawCircle(50, 50, 50, paint);
9 canvas->saveLayerAlpha(nullptr, 128);
10 paint.setColor(SK_ColorBLUE);
11 canvas->drawCircle(100, 50, 50, paint);
12 paint.setColor(SK_ColorGREEN);
13 paint.setAlpha(128);
14 canvas->drawCircle(75, 90, 50, paint);
15 canvas->restore();
16}
17} // END FIDDLE
REG_FIDDLE(Canvas_saveLayerAlpha, 256, 256, false, 0)
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void restore()
Definition: SkCanvas.cpp:461
int saveLayerAlpha(const SkRect *bounds, U8CPU alpha)
Definition: SkCanvas.h:661
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
const Paint & paint
Definition: color_source.cc:38