Flutter Engine
The Flutter Engine
Functions
shadermaskfilter.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/SkCoverageMode.h"
#include "include/core/SkFont.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPicture.h"
#include "include/core/SkPictureRecorder.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkGradientShader.h"
#include "include/effects/SkImageFilters.h"
#include "include/effects/SkShaderMaskFilter.h"
#include "include/utils/SkTextUtils.h"
#include "src/core/SkBlendModePriv.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
#include <initializer_list>

Go to the source code of this file.

Functions

static sk_sp< SkShadermake_shader (const SkRect &r)
 
 DEF_SIMPLE_GM (shadermaskfilter_gradient, canvas, 512, 512)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( shadermaskfilter_gradient  ,
canvas  ,
512  ,
512   
)

Definition at line 51 of file shadermaskfilter.cpp.

51 {
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
60 paint.setMaskFilter(mf);
61 paint.setColor(SK_ColorRED);
62 paint.setAntiAlias(true);
63 canvas->drawOval(r, paint);
64}
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static sk_sp< SkMaskFilter > Make(sk_sp< SkShader > shader)
const Paint & paint
Definition: color_source.cc:38
static sk_sp< SkShader > make_shader(const SkRect &r)

◆ make_shader()

static sk_sp< SkShader > make_shader ( const SkRect r)
static

Definition at line 43 of file shadermaskfilter.cpp.

43 {
44 const SkPoint pts[] = {
45 { r.fLeft, r.fTop }, { r.fRight, r.fBottom },
46 };
47 const SkColor colors[] = { 0, SK_ColorWHITE };
49}
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
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)
PODArray< SkColor > colors
Definition: SkRecords.h:276
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15