Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
SkLumaColorFilter Struct Reference

#include <SkLumaColorFilter.h>

Static Public Member Functions

static sk_sp< SkColorFilterMake ()
 

Detailed Description

SkLumaColorFilter multiplies the luma of its input into the alpha channel, and sets the red, green, and blue channels to zero.

SkLumaColorFilter(r,g,b,a) = {0,0,0, a * luma(r,g,b)}

This is similar to a luminanceToAlpha feColorMatrix, but note how this filter folds in the previous alpha, something an feColorMatrix cannot do.

feColorMatrix(luminanceToAlpha; r,g,b,a) = {0,0,0, luma(r,g,b)}

(Despite its name, an feColorMatrix using luminanceToAlpha does actually compute luma, a dot-product of gamma-encoded color channels, not luminance, a dot-product of linear color channels. So at least SkLumaColorFilter and feColorMatrix+luminanceToAlpha agree there.)

Definition at line 33 of file SkLumaColorFilter.h.

Member Function Documentation

◆ Make()

sk_sp< SkColorFilter > SkLumaColorFilter::Make ( )
static

Definition at line 145 of file SkRuntimeColorFilter.cpp.

145 {
146 using namespace SkKnownRuntimeEffects;
147
148 const SkRuntimeEffect* lumaEffect = GetKnownRuntimeEffect(StableKey::kLuma);
149
150 return lumaEffect->makeColorFilter(SkData::MakeEmpty());
151}
static sk_sp< SkData > MakeEmpty()
Definition SkData.cpp:94
sk_sp< SkColorFilter > makeColorFilter(sk_sp< const SkData > uniforms) const
const SkRuntimeEffect * GetKnownRuntimeEffect(StableKey stableKey)

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