Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
gm
bug6643.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017 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/SkCanvas.h
"
10
#include "
include/core/SkColor.h
"
11
#include "
include/core/SkPaint.h
"
12
#include "
include/core/SkPicture.h
"
13
#include "
include/core/SkPictureRecorder.h
"
14
#include "
include/core/SkRefCnt.h
"
15
#include "
include/core/SkShader.h
"
16
#include "
include/core/SkTileMode.h
"
17
#include "
include/core/SkTypes.h
"
18
#include "
include/effects/SkGradientShader.h
"
19
20
DEF_SIMPLE_GM
(bug6643, canvas, 200, 200) {
21
SkColor
colors[] = {
SK_ColorTRANSPARENT
,
SK_ColorGREEN
,
SK_ColorTRANSPARENT
};
22
23
SkPaint
p;
24
p.setAntiAlias(
true
);
25
p.setShader(
SkGradientShader::MakeSweep
(100, 100, colors,
nullptr
, std::size(colors),
26
SkGradientShader::kInterpolateColorsInPremul_Flag
,
27
nullptr
));
28
29
SkPictureRecorder
recorder;
30
recorder.
beginRecording
(200, 200)->
drawPaint
(p);
31
32
p.setShader(recorder.
finishRecordingAsPicture
()->
makeShader
(
33
SkTileMode::kRepeat
,
SkTileMode::kRepeat
,
34
SkFilterMode::kNearest
,
nullptr
,
nullptr
));
35
canvas->drawColor(
SK_ColorWHITE
);
36
canvas->drawPaint(p);
37
}
SkCanvas.h
SkColor.h
SkColor
uint32_t SkColor
Definition
SkColor.h:37
SK_ColorTRANSPARENT
constexpr SkColor SK_ColorTRANSPARENT
Definition
SkColor.h:99
SK_ColorGREEN
constexpr SkColor SK_ColorGREEN
Definition
SkColor.h:131
SK_ColorWHITE
constexpr SkColor SK_ColorWHITE
Definition
SkColor.h:122
SkGradientShader.h
SkPaint.h
SkPictureRecorder.h
SkPicture.h
SkRefCnt.h
SkFilterMode::kNearest
@ kNearest
SkShader.h
SkTileMode.h
SkTileMode::kRepeat
@ kRepeat
SkTypes.h
SkCanvas::drawPaint
void drawPaint(const SkPaint &paint)
Definition
SkCanvas.cpp:1992
SkGradientShader::MakeSweep
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
Definition
SkSweepGradient.cpp:158
SkGradientShader::kInterpolateColorsInPremul_Flag
@ kInterpolateColorsInPremul_Flag
Definition
SkGradientShader.h:68
SkPaint
Definition
SkPaint.h:44
SkPictureRecorder
Definition
SkPictureRecorder.h:32
SkPictureRecorder::beginRecording
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
Definition
SkPictureRecorder.cpp:35
SkPictureRecorder::finishRecordingAsPicture
sk_sp< SkPicture > finishRecordingAsPicture()
Definition
SkPictureRecorder.cpp:67
SkPicture::makeShader
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, const SkMatrix *localMatrix, const SkRect *tileRect) const
Definition
SkPictureShader.cpp:39
gm.h
DEF_SIMPLE_GM
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition
gm.h:50
Generated on Fri Apr 26 2024 06:16:00 for Flutter Engine by
1.9.8