Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
SkRuntimeShaderBuilder Class Reference

#include <SkRuntimeEffect.h>

Inheritance diagram for SkRuntimeShaderBuilder:
SkRuntimeEffectBuilder

Public Member Functions

 SkRuntimeShaderBuilder (sk_sp< SkRuntimeEffect >)
 
 SkRuntimeShaderBuilder (const SkRuntimeShaderBuilder &)=default
 
 ~SkRuntimeShaderBuilder ()
 
sk_sp< SkShadermakeShader (const SkMatrix *localMatrix=nullptr) const
 
- Public Member Functions inherited from SkRuntimeEffectBuilder
const SkRuntimeEffecteffect () const
 
BuilderUniform uniform (std::string_view name)
 
BuilderChild child (std::string_view name)
 
sk_sp< const SkDatauniforms () const
 
SkSpan< const SkRuntimeEffect::ChildPtrchildren () const
 

Friends

class SkRuntimeImageFilter
 

Additional Inherited Members

- Protected Member Functions inherited from SkRuntimeEffectBuilder
 SkRuntimeEffectBuilder ()=delete
 
 SkRuntimeEffectBuilder (sk_sp< SkRuntimeEffect > effect)
 
 SkRuntimeEffectBuilder (sk_sp< SkRuntimeEffect > effect, sk_sp< SkData > uniforms)
 
 SkRuntimeEffectBuilder (SkRuntimeEffectBuilder &&)=default
 
 SkRuntimeEffectBuilder (const SkRuntimeEffectBuilder &)=default
 
SkRuntimeEffectBuilderoperator= (SkRuntimeEffectBuilder &&)=delete
 
SkRuntimeEffectBuilderoperator= (const SkRuntimeEffectBuilder &)=delete
 

Detailed Description

SkRuntimeShaderBuilder is a utility to simplify creating SkShader objects from SkRuntimeEffects.

NOTE: Like SkRuntimeEffect, this API is experimental and subject to change!

Given an SkRuntimeEffect, the SkRuntimeShaderBuilder manages creating an input data block and provides named access to the 'uniform' variables in that block, as well as named access to a list of child shader slots. Usage:

sk_sp<SkRuntimeEffect> effect = ...; SkRuntimeShaderBuilder builder(effect); builder.uniform("some_uniform_float") = 3.14f; builder.uniform("some_uniform_matrix") = SkM44::Rotate(...); builder.child("some_child_effect") = mySkImage->makeShader(...); ... sk_sp<SkShader> shader = builder.makeShader(nullptr, false);

Note that SkRuntimeShaderBuilder is built entirely on the public API of SkRuntimeEffect, so can be used as-is or serve as inspiration for other interfaces or binding techniques.

Definition at line 472 of file SkRuntimeEffect.h.

Constructor & Destructor Documentation

◆ SkRuntimeShaderBuilder() [1/2]

SkRuntimeShaderBuilder::SkRuntimeShaderBuilder ( sk_sp< SkRuntimeEffect effect)
explicit

Definition at line 962 of file SkRuntimeEffect.cpp.

963 : SkRuntimeEffectBuilder(std::move(effect)) {}
const SkRuntimeEffect * effect() const
SkRuntimeEffectBuilder()=delete

◆ SkRuntimeShaderBuilder() [2/2]

SkRuntimeShaderBuilder::SkRuntimeShaderBuilder ( const SkRuntimeShaderBuilder )
default

◆ ~SkRuntimeShaderBuilder()

SkRuntimeShaderBuilder::~SkRuntimeShaderBuilder ( )
default

Member Function Documentation

◆ makeShader()

sk_sp< SkShader > SkRuntimeShaderBuilder::makeShader ( const SkMatrix localMatrix = nullptr) const

Definition at line 967 of file SkRuntimeEffect.cpp.

967 {
968 return this->effect()->makeShader(this->uniforms(), this->children(), localMatrix);
969}
sk_sp< const SkData > uniforms() const
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
sk_sp< SkShader > makeShader(sk_sp< const SkData > uniforms, sk_sp< SkShader > children[], size_t childCount, const SkMatrix *localMatrix=nullptr) const

Friends And Related Function Documentation

◆ SkRuntimeImageFilter

friend class SkRuntimeImageFilter
friend

Definition at line 486 of file SkRuntimeEffect.h.


The documentation for this class was generated from the following files: