Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SkBlenderBase Class Referenceabstract

#include <SkBlenderBase.h>

Inheritance diagram for SkBlenderBase:
SkBlender SkFlattenable SkRefCnt SkRefCntBase SkBlendModeBlender SkRuntimeBlender

Public Types

enum class  BlenderType { 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

virtual std::optional< SkBlendModeasBlendMode () const
 
bool affectsTransparentBlack () const
 
bool appendStages (const SkStageRec &rec) const
 
virtual bool onAppendStages (const SkStageRec &rec) const =0
 
virtual SkRuntimeEffectasRuntimeEffect () const
 
SkFlattenable::Type getFlattenableType () const override
 
virtual BlenderType type () const =0
 
- 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
 

Static Public Member Functions

static SkFlattenable::Type GetFlattenableType ()
 
- Static Public Member Functions inherited from SkBlender
static sk_sp< SkBlenderMode (SkBlendMode mode)
 
- 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)
 

Detailed Description

Encapsulates a blend function, including non-public APIs. Blends combine a source color (the result of our paint) and destination color (from the canvas) into a final color.

Definition at line 39 of file SkBlenderBase.h.

Member Enumeration Documentation

◆ BlenderType

enum class SkBlenderBase::BlenderType
strong
Enumerator

Definition at line 60 of file SkBlenderBase.h.

60 {
61 #define M(type) k ## type,
63 #undef M
64 };
#define SK_ALL_BLENDERS(M)
Definition: SkBlenderBase.h:30

Member Function Documentation

◆ affectsTransparentBlack()

bool SkBlenderBase::affectsTransparentBlack ( ) const

Definition at line 79 of file SkBlendModeBlender.cpp.

79 {
80 if (auto blendMode = this->asBlendMode()) {
82 if (SkBlendMode_AsCoeff(*blendMode, &src, &dst)) {
83 // If the source is (0,0,0,0), then dst is preserved as long as its coefficient
84 // evaluates to 1.0. This is true for kOne, kISA, and kISC. Anything else means the
85 // blend mode affects transparent black.
86 return dst != SkBlendModeCoeff::kOne &&
89 } else {
90 // An advanced blend mode, which do not affect transparent black
91 return false;
92 }
93 } else {
94 // Blenders that aren't blend modes are assumed to modify transparent black.
95 return true;
96 }
97}
SK_API bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff *src, SkBlendModeCoeff *dst)
Definition: SkBlendMode.cpp:57
SkBlendModeCoeff
Definition: SkBlendMode.h:84
virtual std::optional< SkBlendMode > asBlendMode() const
Definition: SkBlenderBase.h:45
dst
Definition: cp.py:12

◆ appendStages()

bool SkBlenderBase::appendStages ( const SkStageRec rec) const
inline

Definition at line 49 of file SkBlenderBase.h.

49 {
50 return this->onAppendStages(rec);
51 }
virtual bool onAppendStages(const SkStageRec &rec) const =0

◆ asBlendMode()

virtual std::optional< SkBlendMode > SkBlenderBase::asBlendMode ( ) const
inlinevirtual

Returns true if this SkBlender represents any SkBlendMode, and returns the blender's SkBlendMode in mode. Returns false for other types of blends.

Definition at line 45 of file SkBlenderBase.h.

45{ return {}; }

◆ asRuntimeEffect()

virtual SkRuntimeEffect * SkBlenderBase::asRuntimeEffect ( ) const
inlinevirtual

Reimplemented in SkRuntimeBlender.

Definition at line 55 of file SkBlenderBase.h.

55{ return nullptr; }

◆ GetFlattenableType()

static SkFlattenable::Type SkBlenderBase::GetFlattenableType ( )
inlinestatic

Definition at line 57 of file SkBlenderBase.h.

57{ return kSkBlender_Type; }

◆ getFlattenableType()

SkFlattenable::Type SkBlenderBase::getFlattenableType ( ) const
inlineoverridevirtual

Implements SkFlattenable.

Definition at line 58 of file SkBlenderBase.h.

58{ return GetFlattenableType(); }
static SkFlattenable::Type GetFlattenableType()
Definition: SkBlenderBase.h:57

◆ onAppendStages()

virtual bool SkBlenderBase::onAppendStages ( const SkStageRec rec) const
pure virtual

Implemented in SkRuntimeBlender.

◆ type()

virtual BlenderType SkBlenderBase::type ( ) const
pure virtual

Implemented in SkBlendModeBlender, and SkRuntimeBlender.


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