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

Luminance-to-alpha color filter, as defined in http://www.w3.org/TR/SVG/masking.html#Masking http://www.w3.org/TR/css-masking/#MaskValues. More...

#include <SkLumaColorFilter.h>

Inheritance diagram for SkLumaColorFilter:
SkColorFilter SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

void filterSpan (const SkPMColor src[], int count, SkPMColor[]) const override
 Called with a scanline of colors, as if there was a shader installed. More...
 
- Public Member Functions inherited from SkColorFilter
virtual bool asColorMode (SkColor *color, SkBlendMode *bmode) const
 If the filter can be represented by a source color plus Mode, this returns true, and sets (if not NULL) the color and mode appropriately. More...
 
virtual bool asColorMatrix (SkScalar matrix[20]) const
 If the filter can be represented by a 5x4 matrix, this returns true, and sets the matrix appropriately. More...
 
virtual bool asComponentTable (SkBitmap *table) const
 If the filter can be represented by per-component table, return true, and if table is not null, copy the bitmap containing the table into it. More...
 
void appendStages (SkRasterPipeline *, SkColorSpace *, SkArenaAlloc *, bool shaderIsOpaque) const
 
virtual uint32_t getFlags () const
 Returns the flags for this filter. More...
 
virtual sk_sp< SkColorFiltermakeComposed (sk_sp< SkColorFilter >) const
 If this subclass can optimally createa composition with the inner filter, return it as a new filter (which the caller must unref() when it is done). More...
 
SkColor filterColor (SkColor) const
 Apply this colorfilter to the specified SkColor. More...
 
SkColor4f filterColor4f (const SkColor4f &) const
 Filters a single color.
 
virtual sk_sp
< GrFragmentProcessor > 
asFragmentProcessor (GrContext *, SkColorSpace *dstColorSpace) const
 A subclass may implement this factory function to work with the GPU backend. More...
 
bool affectsTransparentBlack () 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< SkColorFilterMake ()
 
- Static Public Member Functions inherited from SkColorFilter
static sk_sp< SkColorFilterMakeModeFilter (SkColor c, SkBlendMode mode)
 Create a colorfilter that uses the specified color and mode. More...
 
static sk_sp< SkColorFilterMakeComposeFilter (sk_sp< SkColorFilter > outer, sk_sp< SkColorFilter > inner)
 Construct a colorfilter whose effect is to first apply the inner filter and then apply the outer filter to the result of the inner's. More...
 
static sk_sp< SkColorFilterMakeMatrixFilterRowMajor255 (const SkScalar array[20])
 Construct a color filter that transforms a color by a 4x5 matrix. More...
 
- 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 SkColorFilter
sk_sp< SkColorFiltermakeColorSpace (SkColorSpaceXformer *xformer) const
 
virtual sk_sp< SkColorFilteronMakeColorSpace (SkColorSpaceXformer *) const
 
- 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 SkColorFilter INHERITED
 

Private Member Functions

void onAppendStages (SkRasterPipeline *, SkColorSpace *, SkArenaAlloc *, bool shaderIsOpaque) const override
 

Additional Inherited Members

- Public Types inherited from SkColorFilter
enum  Flags { kAlphaUnchanged_Flag = 1 << 0 }
 
- 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 &)
 

Detailed Description

Luminance-to-alpha color filter, as defined in http://www.w3.org/TR/SVG/masking.html#Masking http://www.w3.org/TR/css-masking/#MaskValues.

The resulting color is black with transparency equal to the luminance value modulated by alpha:

C' = [ Lum * a, 0, 0, 0 ]

Member Function Documentation

void SkLumaColorFilter::filterSpan ( const SkPMColor  src[],
int  count,
SkPMColor  result[] 
) const
overridevirtual

Called with a scanline of colors, as if there was a shader installed.

The implementation writes out its filtered version into result[]. Note: shader and result may be the same buffer.

Parameters
srcarray of colors, possibly generated by a shader
countthe number of entries in the src[] and result[] arrays
resultwritten by the filter

Implements SkColorFilter.


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