blob: 4e65ed823f068cdd1e15a3fb309680f6f10d883d [file] [log] [blame]
Hal Canary83c2f702019-03-07 14:53:03 -05001// 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 "fiddle/examples.h"
4// HASH=ab6577df079e6c70511cf2bfc6447b44
5REG_FIDDLE(Bitmap_074, 256, 100, false, 0) {
6void draw(SkCanvas* canvas) {
7 SkBitmap alpha, bitmap;
8 bitmap.allocN32Pixels(100, 100);
9 SkCanvas offscreen(bitmap);
10 offscreen.clear(0);
11 SkPaint paint;
12 paint.setAntiAlias(true);
13 paint.setColor(SK_ColorBLUE);
14 paint.setStyle(SkPaint::kStroke_Style);
15 paint.setStrokeWidth(20);
16 offscreen.drawCircle(50, 50, 39, paint);
17 offscreen.flush();
18 bitmap.extractAlpha(&alpha);
19 paint.setColor(SK_ColorRED);
20 canvas->drawBitmap(bitmap, 0, 0, &paint);
21 canvas->drawBitmap(alpha, 100, 0, &paint);
22}
23} // END FIDDLE