Flutter Engine
The Flutter Engine
filters.cpp
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "export.h"
6#include "helpers.h"
7
11
12using namespace Skwasm;
13
15 SkScalar sigmaY,
16 SkTileMode tileMode) {
17 return SkImageFilters::Blur(sigmaX, sigmaY, tileMode, nullptr).release();
18}
19
21 SkScalar radiusY) {
22 return SkImageFilters::Dilate(radiusX, radiusY, nullptr).release();
23}
24
26 SkScalar radiusY) {
27 return SkImageFilters::Erode(radiusX, radiusY, nullptr).release();
28}
29
31 FilterQuality quality) {
34 nullptr)
35 .release();
36}
37
39 SkColorFilter* filter) {
40 return SkImageFilters::ColorFilter(sk_ref_sp<SkColorFilter>(filter), nullptr)
41 .release();
42}
43
45 SkImageFilter* inner) {
46 return SkImageFilters::Compose(sk_ref_sp<SkImageFilter>(outer),
47 sk_ref_sp<SkImageFilter>(inner))
48 .release();
49}
50
52 filter->unref();
53}
54
56 SkIRect* inOutBounds) {
57 SkIRect outputRect =
58 filter->filterBounds(*inOutBounds, SkMatrix(),
59 SkImageFilter::MapDirection::kForward_MapDirection);
60 *inOutBounds = outputRect;
61}
62
66}
67
69 float* matrixData // 20 values
70) {
71 return SkColorFilters::Matrix(matrixData).release();
72}
73
76}
77
80}
81
83 SkColorFilter* inner) {
84 return SkColorFilters::Compose(sk_ref_sp<SkColorFilter>(outer),
85 sk_ref_sp<SkColorFilter>(inner))
86 .release();
87}
88
90 filter->unref();
91}
92
94 SkScalar sigma) {
95 return SkMaskFilter::MakeBlur(blurStyle, sigma).release();
96}
97
99 filter->unref();
100}
SkBlendMode
Definition: SkBlendMode.h:38
SkBlurStyle
Definition: SkBlurTypes.h:11
uint32_t SkColor
Definition: SkColor.h:37
SkTileMode
Definition: SkTileMode.h:13
static sk_sp< SkColorFilter > Compose(const sk_sp< SkColorFilter > &outer, sk_sp< SkColorFilter > inner)
Definition: SkColorFilter.h:92
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > SRGBToLinearGamma()
static sk_sp< SkColorFilter > LinearToSRGBGamma()
SkIRect filterBounds(const SkIRect &src, const SkMatrix &ctm, MapDirection, const SkIRect *inputRect=nullptr) const
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Compose(sk_sp< SkImageFilter > outer, sk_sp< SkImageFilter > inner)
static sk_sp< SkImageFilter > MatrixTransform(const SkMatrix &matrix, const SkSamplingOptions &sampling, sk_sp< SkImageFilter > input)
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
void unref() const
Definition: SkRefCnt.h:72
T * release()
Definition: SkRefCnt.h:324
DlColor color
float SkScalar
Definition: extension.cpp:12
SKWASM_EXPORT void imageFilter_getFilterBounds(SkImageFilter *filter, SkIRect *inOutBounds)
Definition: filters.cpp:55
SKWASM_EXPORT SkImageFilter * imageFilter_compose(SkImageFilter *outer, SkImageFilter *inner)
Definition: filters.cpp:44
SKWASM_EXPORT SkImageFilter * imageFilter_createErode(SkScalar radiusX, SkScalar radiusY)
Definition: filters.cpp:25
SKWASM_EXPORT SkImageFilter * imageFilter_createFromColorFilter(SkColorFilter *filter)
Definition: filters.cpp:38
SKWASM_EXPORT SkImageFilter * imageFilter_createMatrix(SkScalar *matrix33, FilterQuality quality)
Definition: filters.cpp:30
SKWASM_EXPORT SkImageFilter * imageFilter_createDilate(SkScalar radiusX, SkScalar radiusY)
Definition: filters.cpp:20
SKWASM_EXPORT void colorFilter_dispose(SkColorFilter *filter)
Definition: filters.cpp:89
SKWASM_EXPORT SkImageFilter * imageFilter_createBlur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode)
Definition: filters.cpp:14
SKWASM_EXPORT SkColorFilter * colorFilter_createLinearToSRGBGamma()
Definition: filters.cpp:78
SKWASM_EXPORT SkColorFilter * colorFilter_createSRGBToLinearGamma()
Definition: filters.cpp:74
SKWASM_EXPORT void imageFilter_dispose(SkImageFilter *filter)
Definition: filters.cpp:51
SKWASM_EXPORT SkColorFilter * colorFilter_createMatrix(float *matrixData)
Definition: filters.cpp:68
SKWASM_EXPORT SkColorFilter * colorFilter_createMode(SkColor color, SkBlendMode mode)
Definition: filters.cpp:63
SKWASM_EXPORT SkColorFilter * colorFilter_compose(SkColorFilter *outer, SkColorFilter *inner)
Definition: filters.cpp:82
SKWASM_EXPORT void maskFilter_dispose(SkMaskFilter *filter)
Definition: filters.cpp:98
SKWASM_EXPORT SkMaskFilter * maskFilter_createBlur(SkBlurStyle blurStyle, SkScalar sigma)
Definition: filters.cpp:93
Definition: helpers.h:12
SkSamplingOptions samplingOptionsForQuality(FilterQuality quality)
Definition: helpers.h:47
FilterQuality
Definition: helpers.h:29
SkMatrix createMatrix(const SkScalar *f)
Definition: helpers.h:14
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
Definition: SkRect.h:32
#define SKWASM_EXPORT
Definition: export.h:10