Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions
blurroundrect.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRRect.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkGradientShader.h"
#include "src/core/SkBlurMask.h"

Go to the source code of this file.

Classes

class  SimpleBlurRoundRectGM
 

Functions

static sk_sp< SkShaderMakeRadial ()
 
 DEF_SIMPLE_GM (blur_large_rrects, canvas, 300, 300)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( blur_large_rrects  ,
canvas  ,
300  ,
300   
)

Definition at line 106 of file blurroundrect.cpp.

106 {
109
110 auto rect = SkRect::MakeLTRB(5.f, -20000.f, 240.f, 25.f);
111 SkRRect rrect = SkRRect::MakeRectXY(rect, 40.f, 40.f);
112 for (int i = 0; i < 4; ++i) {
113 SkColor4f color{(i & 1) ? 1.f : 0.f,
114 (i & 2) ? 1.f : 0.f,
115 (i < 2) ? 1.f : 0.f,
116 1.f};
117 paint.setColor(color);
118 canvas->drawRRect(rrect, paint);
119 canvas->rotate(90.f, 150.f, 150.f);
120 }
121}
SkColor4f color
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition SkBlurTypes.h:12
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition SkRRect.h:180
const Paint & paint
SkRRect rrect
Definition SkRecords.h:232
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646

◆ MakeRadial()

static sk_sp< SkShader > MakeRadial ( )
static

Definition at line 33 of file blurroundrect.cpp.

33 {
34 SkPoint pts[2] = {
35 { 0, 0 },
36 { SkIntToScalar(100), SkIntToScalar(100) }
37 };
40 const SkScalar pos[] = { SK_Scalar1/4, SK_Scalar1*3/4 };
42 scale.setScale(0.5f, 0.5f);
43 scale.postTranslate(5.f, 5.f);
44 SkPoint center0, center1;
45 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
46 SkScalarAve(pts[0].fY, pts[1].fY));
47 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
48 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
49 return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 7,
50 center0, (pts[1].fX - pts[0].fX) / 2,
51 colors, pos, std::size(colors), tm,
52 0, &scale);
53}
SkPoint pos
uint32_t SkColor
Definition SkColor.h:37
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
#define SK_Scalar1
Definition SkScalar.h:18
#define SkScalarAve(a, b)
Definition SkScalar.h:74
#define SkIntToScalar(x)
Definition SkScalar.h:57
static SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t)
Definition SkScalar.h:131
SkTileMode
Definition SkTileMode.h:13
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
Definition SkMatrix.cpp:281
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Definition SkMatrix.cpp:296
float SkScalar
Definition extension.cpp:12
PODArray< SkColor > colors
Definition SkRecords.h:276
const Scalar scale
void set(float x, float y)