Flutter Engine
The Flutter Engine
third_party
skia
gm
shadermaskfilter.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2018 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
"
9
#include "
include/core/SkBlendMode.h
"
10
#include "
include/core/SkBlurTypes.h
"
11
#include "
include/core/SkCanvas.h
"
12
#include "
include/core/SkColor.h
"
13
#include "
include/core/SkCoverageMode.h
"
14
#include "
include/core/SkFont.h
"
15
#include "
include/core/SkImage.h
"
16
#include "
include/core/SkImageFilter.h
"
17
#include "
include/core/SkImageInfo.h
"
18
#include "
include/core/SkMaskFilter.h
"
19
#include "
include/core/SkMatrix.h
"
20
#include "
include/core/SkPaint.h
"
21
#include "
include/core/SkPath.h
"
22
#include "
include/core/SkPicture.h
"
23
#include "
include/core/SkPictureRecorder.h
"
24
#include "
include/core/SkPoint.h
"
25
#include "
include/core/SkRect.h
"
26
#include "
include/core/SkRefCnt.h
"
27
#include "
include/core/SkScalar.h
"
28
#include "
include/core/SkShader.h
"
29
#include "
include/core/SkString.h
"
30
#include "
include/core/SkSurface.h
"
31
#include "
include/core/SkTileMode.h
"
32
#include "
include/core/SkTypes.h
"
33
#include "
include/effects/SkGradientShader.h
"
34
#include "
include/effects/SkImageFilters.h
"
35
#include "
include/effects/SkShaderMaskFilter.h
"
36
#include "
include/utils/SkTextUtils.h
"
37
#include "
src/core/SkBlendModePriv.h
"
38
#include "
tools/Resources.h
"
39
#include "
tools/ToolUtils.h
"
40
41
#include <initializer_list>
42
43
static
sk_sp<SkShader>
make_shader
(
const
SkRect
& r) {
44
const
SkPoint
pts[] = {
45
{ r.
fLeft
, r.
fTop
}, { r.
fRight
, r.
fBottom
},
46
};
47
const
SkColor
colors
[] = { 0,
SK_ColorWHITE
};
48
return
SkGradientShader::MakeLinear
(pts,
colors
,
nullptr
, 2,
SkTileMode::kRepeat
);
49
}
50
51
DEF_SIMPLE_GM
(shadermaskfilter_gradient, canvas, 512, 512) {
52
SkRect
r = { 0, 0, 100, 150 };
53
auto
shader =
make_shader
(r);
54
auto
mf =
SkShaderMaskFilter::Make
(shader);
55
56
canvas->translate(20, 20);
57
canvas->scale(2, 2);
58
59
SkPaint
paint
;
60
paint
.setMaskFilter(mf);
61
paint
.setColor(
SK_ColorRED
);
62
paint
.setAntiAlias(
true
);
63
canvas->drawOval(r,
paint
);
64
}
Resources.h
SkBlendModePriv.h
SkBlendMode.h
SkBlurTypes.h
SkCanvas.h
SkColor.h
SkColor
uint32_t SkColor
Definition:
SkColor.h:37
SK_ColorRED
constexpr SkColor SK_ColorRED
Definition:
SkColor.h:126
SK_ColorWHITE
constexpr SkColor SK_ColorWHITE
Definition:
SkColor.h:122
SkCoverageMode.h
SkFont.h
SkGradientShader.h
SkImageFilter.h
SkImageFilters.h
SkImageInfo.h
SkImage.h
SkMaskFilter.h
SkMatrix.h
SkPaint.h
SkPath.h
SkPictureRecorder.h
SkPicture.h
SkPoint.h
SkRect.h
SkRefCnt.h
SkScalar.h
SkShaderMaskFilter.h
SkShader.h
SkString.h
SkSurface.h
SkTextUtils.h
SkTileMode.h
SkTileMode::kRepeat
@ kRepeat
SkTypes.h
ToolUtils.h
SkGradientShader::MakeLinear
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Definition:
SkLinearGradient.cpp:132
SkPaint
Definition:
SkPaint.h:44
SkShaderMaskFilter::Make
static sk_sp< SkMaskFilter > Make(sk_sp< SkShader > shader)
Definition:
SkShaderMaskFilterImpl.cpp:94
sk_sp< SkShader >
paint
const Paint & paint
Definition:
color_source.cc:38
gm.h
SkRecords::colors
PODArray< SkColor > colors
Definition:
SkRecords.h:276
make_shader
static sk_sp< SkShader > make_shader(const SkRect &r)
Definition:
shadermaskfilter.cpp:43
DEF_SIMPLE_GM
DEF_SIMPLE_GM(shadermaskfilter_gradient, canvas, 512, 512)
Definition:
shadermaskfilter.cpp:51
SkPoint
Definition:
SkPoint_impl.h:163
SkRect
Definition:
extension.cpp:13
SkRect::fBottom
SkScalar fBottom
larger y-axis bounds
Definition:
extension.cpp:17
SkRect::fLeft
SkScalar fLeft
smaller x-axis bounds
Definition:
extension.cpp:14
SkRect::fRight
SkScalar fRight
larger x-axis bounds
Definition:
extension.cpp:16
SkRect::fTop
SkScalar fTop
smaller y-axis bounds
Definition:
extension.cpp:15
Generated on Sun Jun 23 2024 21:56:01 for Flutter Engine by
1.9.4