Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions
DegenerateTwoPtRadialsSlide.cpp File Reference
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkString.h"
#include "include/effects/SkGradientShader.h"
#include "tools/fonts/FontToolUtils.h"
#include "tools/viewer/Slide.h"

Go to the source code of this file.

Classes

class  DegenerateTwoPtRadialsSlide
 

Functions

static void draw_gradient2 (SkCanvas *canvas, const SkRect &rect, SkScalar delta)
 

Function Documentation

◆ draw_gradient2()

static void draw_gradient2 ( SkCanvas canvas,
const SkRect rect,
SkScalar  delta 
)
static

Definition at line 15 of file DegenerateTwoPtRadialsSlide.cpp.

15 {
17 SkScalar pos[] = { 0, 0.25f, 0.75f, SK_Scalar1 };
18
19 SkScalar l = rect.fLeft;
20 SkScalar t = rect.fTop;
21 SkScalar w = rect.width();
22 SkScalar h = rect.height();
23
24 SkASSERT(0 == SkScalarMod(w, SK_Scalar1 * 5));
25
26 SkPoint c0 = { l + 2 * w / 5 + delta, t + h / 2 };
27 SkPoint c1 = { l + 3 * w / 5, t + h / 2 };
28 SkScalar r0 = w / 5;
29 SkScalar r1 = 2 * w / 5;
31 paint.setShader(SkGradientShader::MakeTwoPointConical(c0, r0, c1, r1, colors,
32 pos, std::size(pos),
34 canvas->drawRect(rect, paint);
35}
SkPoint pos
#define SkASSERT(cond)
Definition SkAssert.h:116
constexpr SkColor SK_ColorMAGENTA
Definition SkColor.h:147
uint32_t SkColor
Definition SkColor.h:37
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
#define SkScalarMod(x, y)
Definition SkScalar.h:41
#define SK_Scalar1
Definition SkScalar.h:18
void drawRect(const SkRect &rect, const SkPaint &paint)
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)
const Paint & paint
float SkScalar
Definition extension.cpp:12
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
PODArray< SkColor > colors
Definition SkRecords.h:276
SkScalar w
SkScalar h