Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
srgb.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRefCnt.h"
#include "tools/DecodeUtils.h"
#include "tools/Resources.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (srgb_colorfilter, canvas, 512, 256 *3)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( srgb_colorfilter  ,
canvas  ,
512  ,
256 *  3 
)

Definition at line 16 of file srgb.cpp.

16 {
17 auto img = ToolUtils::GetResourceAsImage("images/mandrill_256.png");
18
19 const float array[] = {
20 1, 0, 0, 0, 0,
21 0, 1, 0, 0, 0,
22 0, 0, 1, 0, 0,
23 -1, 0, 0, 1, 0,
24 };
25 auto cf0 = SkColorFilters::Matrix(array);
28
30 SkPaint p;
31 p.setColorFilter(cf0);
32 canvas->drawImage(img, 0, 0);
33 canvas->drawImage(img, 256, 0, sampling, &p);
34
35 p.setColorFilter(cf1);
36 canvas->drawImage(img, 0, 256, sampling, &p);
37 p.setColorFilter(cf1->makeComposed(cf0));
38 canvas->drawImage(img, 256, 256, sampling, &p);
39
40 p.setColorFilter(cf2);
41 canvas->drawImage(img, 0, 512, sampling, &p);
42 p.setColorFilter(cf2->makeComposed(cf0));
43 canvas->drawImage(img, 256, 512, sampling, &p);
44}
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > SRGBToLinearGamma()
static sk_sp< SkColorFilter > LinearToSRGBGamma()
SkSamplingOptions sampling
Definition SkRecords.h:337
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition DecodeUtils.h:25