Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
blurpositioning.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/effects/SkImageFilters.h"
#include <initializer_list>

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (check_small_sigma_offset, canvas, 200, 1200)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( check_small_sigma_offset  ,
canvas  ,
200  ,
1200   
)

Definition at line 22 of file blurpositioning.cpp.

22 {
23
24 for (auto sigma : {0.0, 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1.0, 1.2}) {
25 // border calculation from SkBlurImageFilter
26 int border = SkScalarCeilToInt(sigma * 3);
27
28 SkRect r = SkRect::MakeXYWH(50, 50, 100, 50);
29 SkRect b = r.makeOutset(border + 1, border + 1);
30 b.inset(0.5f, 0.5f);
31 SkPaint p;
32 p.setColor(SK_ColorRED);
34
35 canvas->drawRect(b, p);
36
37 p.reset();
38 p.setColor(SK_ColorBLACK);
39 p.setImageFilter(SkImageFilters::Blur(sigma, sigma, nullptr));
40 canvas->drawRect(r, p);
41
42 canvas->translate(0, 100);
43 }
44}
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
#define SkScalarCeilToInt(x)
Definition SkScalar.h:36
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
static bool b
void inset(float dx, float dy)
Definition SkRect.h:1060
SkRect makeOutset(float dx, float dy) const
Definition SkRect.h:1002
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition SkRect.h:659