Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | Friends | List of all members
SkBlender Class Reference

#include <SkBlender.h>

Inheritance diagram for SkBlender:
SkFlattenable SkRefCnt SkRefCntBase SkBlenderBase SkBlendModeBlender SkRuntimeBlender

Static Public Member Functions

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)
 

Friends

class SkBlenderBase
 

Additional Inherited Members

- 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 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
 

Detailed Description

SkBlender represents a custom blend function in the Skia pipeline. When an SkBlender is present in a paint, the SkBlendMode is ignored. A blender combines a source color (the result of our paint) and destination color (from the canvas) into a final color.

Definition at line 19 of file SkBlender.h.

Member Function Documentation

◆ Mode()

sk_sp< SkBlender > SkBlender::Mode ( SkBlendMode  mode)
static

Create a blender that implements the specified BlendMode.

Definition at line 20 of file SkBlendModeBlender.cpp.

20 {
21#define RETURN_SINGLETON_BLENDER(m) \
22 case m: { \
23 static SkNoDestructor<SkBlendModeBlender> sBlender(m); \
24 return sk_ref_sp(sBlender.get()); \
25 }
26
27 switch (mode) {
57 }
58
59 SkDEBUGFAILF("invalid blend mode %d", (int)mode);
60 return nullptr;
61
62#undef RETURN_SINGLETON_BLENDER
63}
#define SkDEBUGFAILF(fmt,...)
Definition SkAssert.h:119
#define RETURN_SINGLETON_BLENDER(m)
@ kSrcOut
r = s * (1-da)
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kPlus
r = min(s + d, 1)
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kDstIn
r = d * sa
@ kModulate
r = s*d
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kScreen
r = s + d - s*d
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDstOut
r = d * (1-sa)
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
@ kSrcIn
r = s * da
@ kClear
r = 0

Friends And Related Symbol Documentation

◆ SkBlenderBase

friend class SkBlenderBase
friend

Definition at line 28 of file SkBlender.h.


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