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

Applies a table lookup on each of the alpha values in the mask. More...

#include <SkTableMaskFilter.h>

Inheritance diagram for SkTableMaskFilter:
SkMaskFilter SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

SkMask::Format getFormat () const override
 Returns the format of the resulting mask that this subclass will return when its filterMask() method is called.
 
bool filterMask (SkMask *, const SkMask &, const SkMatrix &, SkIPoint *) const override
 Create a new mask by filter the src mask. More...
 
- Public Member Functions inherited from SkMaskFilter
virtual bool asFragmentProcessor (GrFragmentProcessor **) const
 Returns true if the filter can be expressed a single-pass GrProcessor without requiring an explicit input mask. More...
 
virtual bool canFilterMaskGPU (const SkRRect &devRRect, const SkIRect &clipBounds, const SkMatrix &ctm, SkRect *maskRect) const
 If asFragmentProcessor() fails the filter may be implemented on the GPU by a subclass overriding filterMaskGPU (declared below). More...
 
virtual bool directFilterMaskGPU (GrContext *, GrRenderTargetContext *renderTargetContext, GrPaint &&paint, const GrClip &, const SkMatrix &viewMatrix, const SkStrokeRec &strokeRec, const SkPath &path) const
 Try to directly render the mask filter into the target. More...
 
virtual bool directFilterRRectMaskGPU (GrContext *, GrRenderTargetContext *renderTargetContext, GrPaint &&paint, const GrClip &, const SkMatrix &viewMatrix, const SkStrokeRec &strokeRec, const SkRRect &rrect, const SkRRect &devRRect) const
 Try to directly render a rounded rect mask filter into the target. More...
 
virtual sk_sp< GrTextureProxy > filterMaskGPU (GrContext *, sk_sp< GrTextureProxy > srcProxy, const SkMatrix &ctm, const SkIRect &maskRect) const
 This function is used to implement filters that require an explicit src mask. More...
 
virtual void computeFastBounds (const SkRect &src, SkRect *dest) const
 The fast bounds function is used to enable the paint to be culled early in the drawing pipeline. More...
 
virtual bool asABlur (BlurRec *) const
 If this filter can be represented by a BlurRec, return true and (if not null) fill in the provided BlurRec parameter. 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...
 
- 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 void MakeGammaTable (uint8_t table[256], SkScalar gamma)
 Utility that sets the gamma table.
 
static void MakeClipTable (uint8_t table[256], uint8_t min, uint8_t max)
 Utility that creates a clipping table: clamps values below min to 0 and above max to 255, and rescales the remaining into 0..255.
 
static SkMaskFilterCreate (const uint8_t table[256])
 
static SkMaskFilterCreateGamma (SkScalar gamma)
 
static SkMaskFilterCreateClip (uint8_t min, uint8_t max)
 
- 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

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()).
 
- Protected Member Functions inherited from SkMaskFilter
virtual FilterReturn filterRectsToNine (const SkRect[], int count, const SkMatrix &, const SkIRect &clipBounds, NinePatch *) const
 Override if your subclass can filter a rect, and return the answer as a ninepatch mask to be stretched over the returned outerRect. More...
 
virtual FilterReturn filterRRectToNine (const SkRRect &, const SkMatrix &, const SkIRect &clipBounds, NinePatch *) const
 Similar to filterRectsToNine, except it performs the work on a round rect.
 
- 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 SkMaskFilter INHERITED
 

Private Member Functions

 SkTableMaskFilter (const uint8_t table[256])
 

Private Attributes

uint8_t fTable [256]
 

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 &)
 
- Protected Types inherited from SkMaskFilter
enum  FilterReturn { kFalse_FilterReturn, kTrue_FilterReturn, kUnimplemented_FilterReturn }
 

Detailed Description

Applies a table lookup on each of the alpha values in the mask.

Helper methods create some common tables (e.g. gamma, clipping)

Member Function Documentation

bool SkTableMaskFilter::filterMask ( SkMask dst,
const SkMask src,
const SkMatrix ,
SkIPoint margin 
) const
overridevirtual

Create a new mask by filter the src mask.

If src.fImage == null, then do not allocate or create the dst image but do fill out the other fields in dstMask. If you do allocate a dst image, use SkMask::AllocImage() If this returns false, dst mask is ignored.

Parameters
dstthe result of the filter. If src.fImage == null, dst should not allocate its image
srcthe original image to be filtered.
matrixthe CTM
marginif not null, return the buffer dx/dy need when calculating the effect. Used when drawing a clipped object to know how much larger to allocate the src before applying the filter. If returning false, ignore this parameter.
Returns
true if the dst mask was correctly created.

Reimplemented from SkMaskFilter.


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