Flutter Engine
The Flutter Engine
Functions
Bitmap_extractAlpha.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Bitmap_extractAlpha, 256, 100, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Bitmap_extractAlpha  ,
256  ,
100  ,
false  ,
 
)

Definition at line 4 of file Bitmap_extractAlpha.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 SkBitmap alpha, bitmap;
7 bitmap.allocN32Pixels(100, 100);
8 SkCanvas offscreen(bitmap);
9 offscreen.clear(0);
11 paint.setAntiAlias(true);
12 paint.setColor(SK_ColorBLUE);
14 paint.setStrokeWidth(20);
15 offscreen.drawCircle(50, 50, 39, paint);
16 bitmap.extractAlpha(&alpha);
17 paint.setColor(SK_ColorRED);
18 canvas->drawImage(bitmap.asImage(), 0, 0, SkSamplingOptions(), &paint);
19 canvas->drawImage(alpha.asImage(), 100, 0, SkSamplingOptions(), &paint);
20}
21} // END FIDDLE
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
sk_sp< SkImage > asImage() const
Definition: SkBitmap.cpp:645
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38
Definition: bitmap.py:1