Flutter Engine
The Flutter Engine
Functions
skgpu::graphite::PrecompileImageFilters Namespace Reference

Functions

SK_API sk_sp< PrecompileImageFilterArithmetic (sk_sp< PrecompileImageFilter > background, sk_sp< PrecompileImageFilter > foreground)
 
SK_API sk_sp< PrecompileImageFilterBlend (SkBlendMode bm, sk_sp< PrecompileImageFilter > background, sk_sp< PrecompileImageFilter > foreground)
 
SK_API sk_sp< PrecompileImageFilterBlend (sk_sp< PrecompileBlender > blender, sk_sp< PrecompileImageFilter > background, sk_sp< PrecompileImageFilter > foreground)
 
SK_API sk_sp< PrecompileImageFilterBlur (sk_sp< PrecompileImageFilter > input)
 
SK_API sk_sp< PrecompileImageFilterColorFilter (sk_sp< PrecompileColorFilter > colorFilter, sk_sp< PrecompileImageFilter > input)
 
SK_API sk_sp< PrecompileImageFilterDisplacementMap (sk_sp< PrecompileImageFilter > input)
 
SK_API sk_sp< PrecompileImageFilterLighting (sk_sp< PrecompileImageFilter > input)
 
SK_API sk_sp< PrecompileImageFilterMatrixConvolution (sk_sp< PrecompileImageFilter > input)
 
SK_API sk_sp< PrecompileImageFilterMorphology (sk_sp< PrecompileImageFilter > input)
 

Function Documentation

◆ Arithmetic()

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::Arithmetic ( sk_sp< PrecompileImageFilter background,
sk_sp< PrecompileImageFilter foreground 
)

Definition at line 143 of file FactoryFunctions.cpp.

145 {
146 return Blend(PrecompileBlenders::Arithmetic(), std::move(background), std::move(foreground));
147}
SK_API sk_sp< PrecompileBlender > Arithmetic()

◆ Blend() [1/2]

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::Blend ( sk_sp< PrecompileBlender blender,
sk_sp< PrecompileImageFilter background,
sk_sp< PrecompileImageFilter foreground 
)

Definition at line 156 of file FactoryFunctions.cpp.

159 {
160
161 if (!blender) {
163 }
164
165 if (std::optional<SkBlendMode> bm = blender->priv().asBlendMode()) {
166 if (bm == SkBlendMode::kSrc) {
167 return foreground;
168 } else if (bm == SkBlendMode::kDst) {
169 return background;
170 } else if (bm == SkBlendMode::kClear) {
171 return nullptr; // TODO: actually return PrecompileImageFilters::Empty
172 }
173 }
174
175 sk_sp<PrecompileImageFilter> inputs[2] = { std::move(background), std::move(foreground) };
176 return sk_make_sp<PrecompileBlendFilterImageFilter>(std::move(blender), inputs);
177}
@ kSrcOver
r = s + (1-sa)*d
@ kClear
r = 0

◆ Blend() [2/2]

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::Blend ( SkBlendMode  bm,
sk_sp< PrecompileImageFilter background,
sk_sp< PrecompileImageFilter foreground 
)

Definition at line 149 of file FactoryFunctions.cpp.

152 {
153 return Blend(PrecompileBlenders::Mode(bm), std::move(background), std::move(foreground));
154}

◆ Blur()

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::Blur ( sk_sp< PrecompileImageFilter input)

Definition at line 223 of file FactoryFunctions.cpp.

224 {
225 return sk_make_sp<PrecompileBlurImageFilter>(SkSpan(&input, 1));
226}
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >

◆ ColorFilter()

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::ColorFilter ( sk_sp< PrecompileColorFilter colorFilter,
sk_sp< PrecompileImageFilter input 
)

Definition at line 268 of file FactoryFunctions.cpp.

270 {
271 if (colorFilter && input) {
272 sk_sp<PrecompileColorFilter> inputCF = input->isColorFilterNode();
273 if (inputCF) {
274 colorFilter = colorFilter->makeComposed(std::move(inputCF));
275 input = sk_ref_sp(input->getInput(0));
276 }
277 }
278
279 sk_sp<PrecompileImageFilter> filter = std::move(input);
280 if (colorFilter) {
281 filter = sk_make_sp<PrecompileColorFilterImageFilter>(std::move(colorFilter),
282 std::move(filter));
283 }
284 return filter;
285}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381

◆ DisplacementMap()

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::DisplacementMap ( sk_sp< PrecompileImageFilter input)

Definition at line 319 of file FactoryFunctions.cpp.

320 {
321 return sk_make_sp<PrecompileDisplacementMapImageFilter>(SkSpan(&input, 1));
322}

◆ Lighting()

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::Lighting ( sk_sp< PrecompileImageFilter input)

Definition at line 353 of file FactoryFunctions.cpp.

354 {
355 return sk_make_sp<PrecompileLightingImageFilter>(SkSpan(&input, 1));
356}

◆ MatrixConvolution()

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::MatrixConvolution ( sk_sp< PrecompileImageFilter input)

Definition at line 390 of file FactoryFunctions.cpp.

391 {
392 return sk_make_sp<PrecompileMatrixConvolutionImageFilter>(SkSpan(&input, 1));
393}

◆ Morphology()

sk_sp< PrecompileImageFilter > skgpu::graphite::PrecompileImageFilters::Morphology ( sk_sp< PrecompileImageFilter input)

Definition at line 445 of file FactoryFunctions.cpp.

446 {
447 return sk_make_sp<PrecompileMorphologyImageFilter>(SkSpan(&input, 1));
448}