Flutter Engine
The Flutter Engine
Functions
blend.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "tools/ToolUtils.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (blend, canvas, 300, 100)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( blend  ,
canvas  ,
300  ,
100   
)

Definition at line 15 of file blend.cpp.

15 {
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
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