Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkDrawLooper Class Referenceabstract

Subclasses of SkDrawLooper can be attached to a SkPaint. More...

#include <SkDrawLooper.h>

Inheritance diagram for SkDrawLooper:
SkFlattenable SkRefCnt SkRefCntBase SkLayerDrawLooper

Classes

struct  BlurShadowRec
 
class  Context
 Holds state during a draw. More...
 

Public Member Functions

virtual ContextmakeContext (SkCanvas *, SkArenaAlloc *) const =0
 Called right before something is being drawn. More...
 
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
 
virtual bool asABlurShadow (BlurShadowRec *) const
 If this looper can be interpreted as having two layers, such that. More...
 
- 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...
 
virtual void flatten (SkWriteBuffer &) const
 Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()).
 
- 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...
 

Protected Member Functions

sk_sp< SkDrawLoopermakeColorSpace (SkColorSpaceXformer *xformer) const
 
virtual sk_sp< SkDrawLooperonMakeColorSpace (SkColorSpaceXformer *) const =0
 
- 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

typedef SkFlattenable INHERITED
 

Friends

class SkColorSpaceXformer
 

Additional Inherited Members

- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type, kSkDrawable_Type, kSkDrawLooper_Type, kSkImageFilter_Type,
  kSkMaskFilter_Type, kSkPathEffect_Type, kSkPixelRef_Type, kSkRasterizer_Type,
  kSkShaderBase_Type, kSkUnused_Type, kSkUnused_Xfermode_Type, kSkNormalSource_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory )(SkReadBuffer &)
 
- 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)
 

Detailed Description

Subclasses of SkDrawLooper can be attached to a SkPaint.

Where they are, and something is drawn to a canvas with that paint, the looper subclass will be called, allowing it to modify the canvas and/or paint for that draw call. More than that, via the next() method, the looper can modify the draw to be invoked multiple times (hence the name loop-er), allow it to perform effects like shadows or frame/fills, that require more than one pass.

Member Function Documentation

virtual bool SkDrawLooper::asABlurShadow ( BlurShadowRec ) const
virtual

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 in SkLayerDrawLooper.

bool SkDrawLooper::canComputeFastBounds ( const SkPaint paint) const

The fast bounds functions are used to enable the paint to be culled early in the drawing pipeline.

If a subclass can support this feature it must return true for the canComputeFastBounds() function. If that function returns false then computeFastBounds behavior is undefined otherwise it is expected to have the following behavior. Given the parent paint and the parent's bounding rect the subclass must fill in and return the storage rect, where the storage rect is with the union of the src rect and the looper's bounding rect.

virtual Context* SkDrawLooper::makeContext ( SkCanvas ,
SkArenaAlloc *   
) const
pure virtual

Called right before something is being drawn.

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

Implemented in SkLayerDrawLooper.


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