Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Color_Constants_c.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.
4// HASH=6971489f28291f08e429cc6ccc73b09b
5REG_FIDDLE(Color_Constants_c, 256, 256, false, 0) {
6void draw(SkCanvas* canvas) {
7 std::vector<uint32_t> srcPixels;
8 constexpr int width = 256;
9 constexpr int height = 256;
10 srcPixels.resize(width * height);
12 SkPixmap pixmap(imageInfo, &srcPixels.front(), imageInfo.minRowBytes());
14 pixmap.erase(SK_ColorRED, { 24, 24, 192, 192 } );
15 pixmap.erase(SK_ColorBLACK, { 48, 48, 168, 168 } );
17 bitmap.installPixels(pixmap);
18 canvas->drawImage(bitmap.asImage(), 0, 0);
19 canvas->drawImage(bitmap.asImage(), 48, 48);
20}
21} // END FIDDLE
constexpr SkColor SK_ColorTRANSPARENT
Definition SkColor.h:99
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
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
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
int32_t height
int32_t width
static SkImageInfo MakeN32Premul(int width, int height)
size_t minRowBytes() const