Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkBlurDrawLooper Class Reference

This class draws a shadow of the object (possibly offset), and then draws the original object in its original position. More...

#include <SkBlurDrawLooper.h>

Inheritance diagram for SkBlurDrawLooper:
SkDrawLooper SkFlattenable SkRefCnt SkRefCntBase

Classes

class  BlurDrawLooperContext
 

Public Types

enum  BlurFlags {
  kNone_BlurFlag = 0x00, kIgnoreTransform_BlurFlag = 0x01, kOverrideColor_BlurFlag = 0x02, kHighQuality_BlurFlag = 0x04,
  kAll_BlurFlag = 0x07
}
 
- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type, kSkDrawable_Type, kSkDrawLooper_Type, kSkImageFilter_Type,
  kSkMaskFilter_Type, kSkPathEffect_Type, kSkPixelRef_Type, kSkRasterizer_Type,
  kSkShader_Type, kSkUnused_Type, kSkXfermode_Type, kSkNormalSource_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory )(SkReadBuffer &)
 

Public Member Functions

SkDrawLooper::ContextmakeContext (SkCanvas *, SkArenaAlloc *) const override
 Called right before something is being drawn. More...
 
- Public Member Functions inherited from SkDrawLooper
bool canComputeFastBounds (const SkPaint &paint) const
 The fast bounds functions are used to enable the paint to be culled early in the drawing pipeline. More...
 
void computeFastBounds (const SkPaint &paint, const SkRect &src, SkRect *dst) const
 
- Public Member Functions inherited from SkFlattenable
virtual Factory getFactory () const =0
 Implement this to return a factory function pointer that can be called to recreate your class given a buffer (previously written to by your override of flatten().
 
virtual const char * getTypeName () const
 Returns the name of the object's class. More...
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 Default construct, initializing the reference count to 1.
 
virtual ~SkRefCntBase ()
 Destruct, asserting that the reference count is 1.
 
int32_t getRefCnt () const
 Return the reference count. More...
 
void validate () const
 
bool unique () const
 May return true if the caller is the only owner. More...
 
void ref () const
 Increment the reference count. More...
 
void unref () const
 Decrement the reference count. More...
 

Static Public Member Functions

static sk_sp< SkDrawLooperMake (SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, uint32_t flags=kNone_BlurFlag)
 
- Static Public Member Functions inherited from SkFlattenable
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static bool NameToType (const char name[], Type *type)
 
static void Register (const char name[], Factory, Type)
 

Protected Member Functions

 SkBlurDrawLooper (SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, uint32_t flags)
 
void flatten (SkWriteBuffer &) const override
 Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()).
 
bool asABlurShadow (BlurShadowRec *) const override
 If this looper can be interpreted as having two layers, such that. More...
 
- Protected Member Functions inherited from SkRefCntBase
void internal_dispose_restore_refcnt_to_1 () const
 Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called or if they choose not to call the destructor (e.g. More...
 

Private Types

enum  State { kBeforeEdge, kAfterEdge, kDone }
 
typedef SkDrawLooper INHERITED
 

Private Member Functions

void init (SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags)
 
void initEffects ()
 

Private Attributes

sk_sp< SkMaskFilterfBlur
 
sk_sp< SkColorFilterfColorFilter
 
SkScalar fDx
 
SkScalar fDy
 
SkScalar fSigma
 
SkColor fBlurColor
 
uint32_t fBlurFlags
 

Detailed Description

This class draws a shadow of the object (possibly offset), and then draws the original object in its original position.

should there be an option to just draw the shadow/blur layer? webkit?

Member Enumeration Documentation

Enumerator
kIgnoreTransform_BlurFlag 

The blur layer's dx/dy/radius aren't affected by the canvas transform.

kAll_BlurFlag 

mask for all blur flags

Member Function Documentation

bool SkBlurDrawLooper::asABlurShadow ( BlurShadowRec ) const
overrideprotectedvirtual

If this looper can be interpreted as having two layers, such that.

  1. The first layer (bottom most) just has a blur and translate
  2. The second layer has no modifications to either paint or canvas
  3. No other layers. then return true, and if not null, fill out the BlurShadowRec).

If any of the above are not met, return false and ignore the BlurShadowRec parameter.

Reimplemented from SkDrawLooper.

SkDrawLooper::Context* SkBlurDrawLooper::makeContext ( SkCanvas ,
SkArenaAlloc *   
) const
overridevirtual

Called right before something is being drawn.

Returns a Context whose next() method should be called until it returns false.

Implements SkDrawLooper.


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