Skia
2D Graphics Library
|
SkRuntimeShaderBuilder is a utility to simplify creating SkShader objects from SkRuntimeEffects. More...
#include <SkRuntimeEffect.h>
Public Member Functions | |
SkRuntimeShaderBuilder (sk_sp< SkRuntimeEffect >) | |
SkRuntimeShaderBuilder (const SkRuntimeShaderBuilder &)=default | |
~SkRuntimeShaderBuilder () | |
sk_sp< SkShader > | makeShader (const SkMatrix *localMatrix=nullptr) const |
const SkRuntimeEffect * | effect () const |
BuilderUniform | uniform (std::string_view name) |
BuilderChild | child (std::string_view name) |
sk_sp< const SkData > | uniforms () const |
SkSpan< const SkRuntimeEffect::ChildPtr > | children () const |
Friends | |
class | SkRuntimeImageFilter |
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.
|
explicit |
|
default |
SkRuntimeShaderBuilder::~SkRuntimeShaderBuilder | ( | ) |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
friend |