Flutter Engine
The Flutter Engine
blend.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm/gm.h"
12#include "include/core/SkRect.h"
13#include "tools/ToolUtils.h"
14
15DEF_SIMPLE_GM(blend, canvas, 300, 100) {
16 SkPaint p;
17
18 // All three of these blocks should be the same color.
19 canvas->save();
20 canvas->scale(100,100);
21
22 p.setColor(SK_ColorRED);
23 canvas->drawRect(SkRect::MakeXYWH(0,0,1,1), p);
24 p.setColor(0xFC208000);
25 canvas->drawRect(SkRect::MakeXYWH(0,0,1,1), p);
26
27 p.setColor(SK_ColorRED);
28 canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p);
29 canvas->saveLayer(nullptr, nullptr);
30 p.setColor(0xFC208000);
31 canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p);
32 canvas->restore();
33
34 p.setColor(SK_ColorRED);
35 canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
36 canvas->saveLayerAlpha(nullptr, 0xFC);
37 p.setColor(ToolUtils::color_to_565(0xFF208000));
38 canvas->drawRect(SkRect::MakeXYWH(2, 0, 1, 1), p);
39 canvas->restore();
40 canvas->restore();
41}
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
DEF_SIMPLE_GM(blend, canvas, 300, 100)
Definition: blend.cpp:15
static SkColor blend(SkColor dst, SkColor src, void(*mode)(float, float, float, float *, float *, float *))
Definition: hsl.cpp:142
SkColor color_to_565(SkColor color)
Definition: ToolUtils.cpp:139
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659