Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
SkMatrixColorFilter Class Referencefinal

#include <SkMatrixColorFilter.h>

Inheritance diagram for SkMatrixColorFilter:
SkColorFilterBase SkColorFilter SkFlattenable SkRefCnt SkRefCntBase

Public Types

enum class  Domain : uint8_t { kRGBA , kHSLA }
 
- Public Types inherited from SkColorFilterBase
enum class  Type { kNoop , M }
 
- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type ,
  kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 

Public Member Functions

 SkMatrixColorFilter (const float array[20], Domain)
 
bool appendStages (const SkStageRec &rec, bool shaderIsOpaque) const override
 
bool onIsAlphaUnchanged () const override
 
SkColorFilterBase::Type type () const override
 
Domain domain () const
 
const float * matrix () const
 
- Public Member Functions inherited from SkColorFilterBase
virtual bool appendStages (const SkStageRec &rec, bool shaderIsOpaque) const =0
 
virtual bool onIsAlphaUnchanged () const
 
virtual Type type () const =0
 
bool affectsTransparentBlack () const
 
virtual SkRuntimeEffectasRuntimeEffect () const
 
SkFlattenable::Type getFlattenableType () const override
 
virtual SkPMColor4f onFilterColor4f (const SkPMColor4f &color, SkColorSpace *dstCS) const
 
- Public Member Functions inherited from SkColorFilter
bool asAColorMode (SkColor *color, SkBlendMode *mode) const
 
bool asAColorMatrix (float matrix[20]) const
 
bool isAlphaUnchanged () const
 
SkColor filterColor (SkColor) const
 
SkColor4f filterColor4f (const SkColor4f &srcColor, SkColorSpace *srcCS, SkColorSpace *dstCS) const
 
sk_sp< SkColorFiltermakeComposed (sk_sp< SkColorFilter > inner) const
 
sk_sp< SkColorFiltermakeWithWorkingColorSpace (sk_sp< SkColorSpace >) const
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
virtual void flatten (SkWriteBuffer &) const
 
virtual Type getFlattenableType () const =0
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Static Public Member Functions inherited from SkColorFilterBase
static SkFlattenable::Type GetFlattenableType ()
 
static sk_sp< SkColorFilterDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
- Static Public Member Functions inherited from SkColorFilter
static sk_sp< SkColorFilterDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
- Static Public Member Functions inherited from SkFlattenable
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 
- Protected Member Functions inherited from SkColorFilterBase
 SkColorFilterBase ()
 
virtual bool onAsAColorMatrix (float[20]) const
 
virtual bool onAsAColorMode (SkColor *color, SkBlendMode *bmode) const
 

Detailed Description

Definition at line 20 of file SkMatrixColorFilter.h.

Member Enumeration Documentation

◆ Domain

enum class SkMatrixColorFilter::Domain : uint8_t
strong
Enumerator
kRGBA 
kHSLA 

Definition at line 22 of file SkMatrixColorFilter.h.

22: uint8_t { kRGBA, kHSLA };
@ kRGBA
Definition: embedder.h:607

Constructor & Destructor Documentation

◆ SkMatrixColorFilter()

SkMatrixColorFilter::SkMatrixColorFilter ( const float  array[20],
Domain  domain 
)
explicit

Definition at line 34 of file SkMatrixColorFilter.cpp.

35 : fAlphaIsUnchanged(is_alpha_unchanged(array)), fDomain(domain) {
36 memcpy(fMatrix, array, 20 * sizeof(float));
37}
static bool is_alpha_unchanged(const float matrix[20])

Member Function Documentation

◆ appendStages()

bool SkMatrixColorFilter::appendStages ( const SkStageRec rec,
bool  shaderIsOpaque 
) const
overridevirtual

Implements SkColorFilterBase.

Definition at line 64 of file SkMatrixColorFilter.cpp.

64 {
65 const bool willStayOpaque = shaderIsOpaque && fAlphaIsUnchanged,
66 hsla = fDomain == Domain::kHSLA;
67
69 if (!shaderIsOpaque) {
70 p->append(SkRasterPipelineOp::unpremul);
71 }
72 if (hsla) {
74 }
75 if (true) {
76 p->append(SkRasterPipelineOp::matrix_4x5, fMatrix);
77 }
78 if (hsla) {
80 }
81 if (true) {
82 p->append(SkRasterPipelineOp::clamp_01);
83 }
84 if (!willStayOpaque) {
86 }
87 return true;
88}
static uint32_t premul(uint32_t color)
static std::unique_ptr< GrFragmentProcessor > hsl_to_rgb(std::unique_ptr< GrFragmentProcessor > child)
static std::unique_ptr< GrFragmentProcessor > rgb_to_hsl(std::unique_ptr< GrFragmentProcessor > child)
SkRasterPipeline * fPipeline
Definition: SkEffectPriv.h:21

◆ domain()

Domain SkMatrixColorFilter::domain ( ) const
inline

Definition at line 32 of file SkMatrixColorFilter.h.

32{ return fDomain; }

◆ matrix()

const float * SkMatrixColorFilter::matrix ( ) const
inline

Definition at line 33 of file SkMatrixColorFilter.h.

33{ return fMatrix; }

◆ onIsAlphaUnchanged()

bool SkMatrixColorFilter::onIsAlphaUnchanged ( ) const
inlineoverridevirtual

Returns the flags for this filter. Override in subclasses to return custom flags.

Reimplemented from SkColorFilterBase.

Definition at line 28 of file SkMatrixColorFilter.h.

28{ return fAlphaIsUnchanged; }

◆ type()

SkColorFilterBase::Type SkMatrixColorFilter::type ( ) const
inlineoverridevirtual

Implements SkColorFilterBase.

Definition at line 30 of file SkMatrixColorFilter.h.

30{ return SkColorFilterBase::Type::kMatrix; }

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