Flutter Engine
The Flutter Engine
Color_Constants_b.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(Color_Constants_b, 256, 256, false, 3) {
5void draw(SkCanvas* canvas) {
6 std::vector<uint32_t> srcPixels;
7 constexpr int width = 256;
8 constexpr int height = 256;
9 srcPixels.resize(width * height);
11 SkPixmap pixmap(imageInfo, &srcPixels.front(), imageInfo.minRowBytes());
13 pixmap.erase(SK_ColorRED, { 24, 24, 192, 192 } );
14 pixmap.erase(SK_ColorTRANSPARENT, { 48, 48, 168, 168 } );
16 bitmap.installPixels(pixmap);
17 canvas->drawImage(bitmap.asImage(), 0, 0);
18 canvas->drawImage(bitmap.asImage(), 48, 48);
19}
20} // END FIDDLE
REG_FIDDLE(Color_Constants_b, 256, 256, false, 3)
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
bool erase(SkColor color, const SkIRect &subset) const
Definition: SkPixmap.cpp:742
Definition: bitmap.py:1
int32_t height
int32_t width
static SkImageInfo MakeN32Premul(int width, int height)
size_t minRowBytes() const
Definition: SkImageInfo.h:517