Skia
2D Graphics Library
SkPath2DPathEffect Class Referenceabstract

#include <Sk2DPathEffect.h>

Inheritance diagram for SkPath2DPathEffect:

Public Types

enum  DashType { kNone_DashType, kDash_DashType }
 If the PathEffect can be represented as a dash pattern, asADash will return kDash_DashType and None otherwise. More...
 
enum  Type {
  kSkColorFilter_Type, kSkDrawable_Type, kSkDrawLooper_Type, kSkImageFilter_Type,
  kSkMaskFilter_Type, kSkPathEffect_Type, kSkPixelRef_Type, kSkUnused_Type4,
  kSkShaderBase_Type, kSkUnused_Type, kSkUnused_Type2, kSkUnused_Type3
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 

Public Member Functions

bool filterPath (SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *cullR) const
 Given a src path (input) and a stroke-rec (input and output), apply this effect to the src path, returning the new path in dst, and return true. More...
 
void computeFastBounds (SkRect *dst, const SkRect &src) const
 Compute a conservative bounds for its effect, given the src bounds. More...
 
bool asPoints (PointData *results, const SkPath &src, const SkStrokeRec &, const SkMatrix &, const SkRect *cullR) const
 Does applying this path effect to 'src' yield a set of points? If so, optionally return the points in 'results'. More...
 
DashType asADash (DashInfo *info) const
 
SkFlattenable::Type getFlattenableType () const override
 
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(). More...
 
virtual const char * getTypeName () const =0
 Returns the name of the object's class. More...
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) 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< SkPathEffectMake (const SkMatrix &matrix, const SkPath &path)
 Stamp the specified path to fill the shape, using the matrix to define the latice. More...
 
static sk_sp< SkPathEffectMakeSum (sk_sp< SkPathEffect > first, sk_sp< SkPathEffect > second)
 Returns a patheffect that apples each effect (first and second) to the original path, and returns a path with the sum of these. More...
 
static sk_sp< SkPathEffectMakeCompose (sk_sp< SkPathEffect > outer, sk_sp< SkPathEffect > inner)
 Returns a patheffect that applies the inner effect to the path, and then applies the outer effect to the result of the inner's. More...
 
static void RegisterFlattenables ()
 
static SkFlattenable::Type GetFlattenableType ()
 
static sk_sp< SkPathEffectDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 

Protected Member Functions

 SkPath2DPathEffect (const SkMatrix &, const SkPath &)
 
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()). More...
 
void next (const SkPoint &, int u, int v, SkPath *) const override
 
virtual void begin (const SkIRect &uvBounds, SkPath *dst) const
 New virtual, to be overridden by subclasses. More...
 
virtual void end (SkPath *dst) const
 
virtual void nextSpan (int u, int v, int ucount, SkPath *dst) const
 Low-level virtual called per span of locations in the u-direction. More...
 
const SkMatrixgetMatrix () const
 
bool onFilterPath (SkPath *, const SkPath &, SkStrokeRec *, const SkRect *) const override
 
virtual SkRect onComputeFastBounds (const SkRect &src) const
 
virtual bool onAsPoints (PointData *, const SkPath &, const SkStrokeRec &, const SkMatrix &, const SkRect *) const
 
virtual DashType onAsADash (DashInfo *) const
 

Member Typedef Documentation

◆ Factory

typedef sk_sp<SkFlattenable>(* SkFlattenable::Factory) (SkReadBuffer &)
inherited

Member Enumeration Documentation

◆ DashType

enum SkPathEffect::DashType
inherited

If the PathEffect can be represented as a dash pattern, asADash will return kDash_DashType and None otherwise.

If a non NULL info is passed in, the various DashInfo will be filled in if the PathEffect can be a dash pattern. If passed in info has an fCount equal or greater to that of the effect, it will memcpy the values of the dash intervals into the info. Thus the general approach will be call asADash once with default info to get DashType and fCount. If effect can be represented as a dash pattern, allocate space for the intervals in info, then call asADash again with the same info and the intervals will get copied in.

Enumerator
kNone_DashType 

ignores the info parameter

kDash_DashType 

fills in all of the info parameter

◆ Type

enum SkFlattenable::Type
inherited
Enumerator
kSkColorFilter_Type 
kSkDrawable_Type 
kSkDrawLooper_Type 
kSkImageFilter_Type 
kSkMaskFilter_Type 
kSkPathEffect_Type 
kSkPixelRef_Type 
kSkUnused_Type4 
kSkShaderBase_Type 
kSkUnused_Type 
kSkUnused_Type2 
kSkUnused_Type3 

Constructor & Destructor Documentation

◆ SkPath2DPathEffect()

SkPath2DPathEffect::SkPath2DPathEffect ( const SkMatrix ,
const SkPath  
)
protected

Member Function Documentation

◆ asADash()

DashType SkPathEffect::asADash ( DashInfo info) const
inherited

◆ asPoints()

bool SkPathEffect::asPoints ( PointData results,
const SkPath src,
const SkStrokeRec ,
const SkMatrix ,
const SkRect cullR 
) const
inherited

Does applying this path effect to 'src' yield a set of points? If so, optionally return the points in 'results'.

◆ begin()

virtual void Sk2DPathEffect::begin ( const SkIRect uvBounds,
SkPath dst 
) const
protectedvirtualinherited

New virtual, to be overridden by subclasses.

This is called once from filterPath, and provides the uv parameter bounds for the path. Subsequent calls to next() will receive u and v values within these bounds, and then a call to end() will signal the end of processing.

◆ computeFastBounds()

void SkPathEffect::computeFastBounds ( SkRect dst,
const SkRect src 
) const
inherited

Compute a conservative bounds for its effect, given the src bounds.

The baseline implementation just assigns src to dst.

◆ Deserialize() [1/2]

static sk_sp<SkPathEffect> SkPathEffect::Deserialize ( const void *  data,
size_t  size,
const SkDeserialProcs procs = nullptr 
)
inlinestaticinherited

◆ Deserialize() [2/2]

static sk_sp<SkFlattenable> SkFlattenable::Deserialize ( Type  ,
const void *  data,
size_t  length,
const SkDeserialProcs procs = nullptr 
)
staticinherited

◆ end()

virtual void Sk2DPathEffect::end ( SkPath dst) const
protectedvirtualinherited

◆ FactoryToName()

static const char* SkFlattenable::FactoryToName ( Factory  )
staticinherited

◆ filterPath()

bool SkPathEffect::filterPath ( SkPath dst,
const SkPath src,
SkStrokeRec ,
const SkRect cullR 
) const
inherited

Given a src path (input) and a stroke-rec (input and output), apply this effect to the src path, returning the new path in dst, and return true.

If this effect cannot be applied, return false and ignore dst and stroke-rec.

The stroke-rec specifies the initial request for stroking (if any). The effect can treat this as input only, or it can choose to change the rec as well. For example, the effect can decide to change the stroke's width or join, or the effect can change the rec from stroke to fill (or fill to stroke) in addition to returning a new (dst) path.

If this method returns true, the caller will apply (as needed) the resulting stroke-rec to dst and then draw.

◆ flatten()

void SkPath2DPathEffect::flatten ( SkWriteBuffer &  ) const
overrideprotectedvirtual

Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()).

DEPRECATED public : will move to protected ... use serialize() instead

Reimplemented from Sk2DPathEffect.

◆ getFactory()

virtual Factory SkFlattenable::getFactory ( ) const
pure virtualinherited

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().

Implemented in SkDrawable.

◆ GetFlattenableType()

static SkFlattenable::Type SkPathEffect::GetFlattenableType ( )
inlinestaticinherited

◆ getFlattenableType()

SkFlattenable::Type SkPathEffect::getFlattenableType ( ) const
inlineoverridevirtualinherited

Implements SkFlattenable.

◆ getMatrix()

const SkMatrix& Sk2DPathEffect::getMatrix ( ) const
inlineprotectedinherited

◆ getTypeName()

virtual const char* SkFlattenable::getTypeName ( ) const
pure virtualinherited

Returns the name of the object's class.

Implemented in SkDrawable.

◆ Make()

static sk_sp<SkPathEffect> SkPath2DPathEffect::Make ( const SkMatrix matrix,
const SkPath path 
)
inlinestatic

Stamp the specified path to fill the shape, using the matrix to define the latice.

◆ MakeCompose()

static sk_sp<SkPathEffect> SkPathEffect::MakeCompose ( sk_sp< SkPathEffect outer,
sk_sp< SkPathEffect inner 
)
staticinherited

Returns a patheffect that applies the inner effect to the path, and then applies the outer effect to the result of the inner's.

result = outer(inner(path))

◆ MakeSum()

static sk_sp<SkPathEffect> SkPathEffect::MakeSum ( sk_sp< SkPathEffect first,
sk_sp< SkPathEffect second 
)
staticinherited

Returns a patheffect that apples each effect (first and second) to the original path, and returns a path with the sum of these.

result = first(path) + second(path)

◆ NameToFactory()

static Factory SkFlattenable::NameToFactory ( const char  name[])
staticinherited

◆ next()

void SkPath2DPathEffect::next ( const SkPoint ,
int  u,
int  v,
SkPath  
) const
overrideprotectedvirtual

Reimplemented from Sk2DPathEffect.

◆ nextSpan()

virtual void Sk2DPathEffect::nextSpan ( int  u,
int  v,
int  ucount,
SkPath dst 
) const
protectedvirtualinherited

Low-level virtual called per span of locations in the u-direction.

The default implementation calls next() repeatedly with each location.

Reimplemented in SkLine2DPathEffect.

◆ onAsADash()

virtual DashType SkPathEffect::onAsADash ( DashInfo ) const
inlineprotectedvirtualinherited

◆ onAsPoints()

virtual bool SkPathEffect::onAsPoints ( PointData ,
const SkPath ,
const SkStrokeRec ,
const SkMatrix ,
const SkRect  
) const
inlineprotectedvirtualinherited

◆ onComputeFastBounds()

virtual SkRect SkPathEffect::onComputeFastBounds ( const SkRect src) const
inlineprotectedvirtualinherited

◆ onFilterPath()

bool Sk2DPathEffect::onFilterPath ( SkPath ,
const SkPath ,
SkStrokeRec ,
const SkRect  
) const
overrideprotectedvirtualinherited

Implements SkPathEffect.

Reimplemented in SkLine2DPathEffect.

◆ ref()

void SkRefCntBase::ref ( ) const
inlineinherited

Increment the reference count.

Must be balanced by a call to unref().

◆ Register()

static void SkFlattenable::Register ( const char  name[],
Factory   
)
staticinherited

◆ RegisterFlattenables()

static void SkPathEffect::RegisterFlattenables ( )
staticinherited

◆ serialize() [1/2]

sk_sp<SkData> SkFlattenable::serialize ( const SkSerialProcs = nullptr) const
inherited

◆ serialize() [2/2]

size_t SkFlattenable::serialize ( void *  memory,
size_t  memory_size,
const SkSerialProcs = nullptr 
) const
inherited

◆ unique()

bool SkRefCntBase::unique ( ) const
inlineinherited

May return true if the caller is the only owner.

Ensures that all previous owner's actions are complete.

◆ unref()

void SkRefCntBase::unref ( ) const
inlineinherited

Decrement the reference count.

If the reference count is 1 before the decrement, then delete the object. Note that if this is the case, then the object needs to have been allocated via new, and not on the stack.


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