Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkPath1DPathEffect Class Reference
Inheritance diagram for SkPath1DPathEffect:
Sk1DPathEffect SkPathEffect SkFlattenable SkRefCnt SkRefCntBase

Public Types

enum  Style { kTranslate_Style, kRotate_Style, kMorph_Style, kLastEnum_Style = kMorph_Style }
 
- Public Types inherited from SkPathEffect
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...
 
- 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 &)
 

Public Member Functions

virtual bool filterPath (SkPath *, const SkPath &, SkStrokeRec *, const SkRect *) const override
 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...
 
- Public Member Functions inherited from SkPathEffect
virtual void computeFastBounds (SkRect *dst, const SkRect &src) const
 Compute a conservative bounds for its effect, given the src bounds. More...
 
virtual 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'.
 
virtual DashType asADash (DashInfo *info) 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< SkPathEffectMake (const SkPath &path, SkScalar advance, SkScalar phase, Style)
 Dash by replicating the specified path. More...
 
- Static Public Member Functions inherited from SkPathEffect
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 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

 SkPath1DPathEffect (const SkPath &path, SkScalar advance, SkScalar phase, Style)
 
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()).
 
SkScalar begin (SkScalar contourLength) const override
 Called at the start of each contour, returns the initial offset into that contour.
 
SkScalar next (SkPath *, SkScalar, SkPathMeasure &) const override
 Called with the current distance along the path, with the current matrix for the point/tangent at the specified distance. 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

typedef Sk1DPathEffect INHERITED
 

Private Attributes

SkPath fPath
 
SkScalar fAdvance
 
SkScalar fInitialOffset
 
Style fStyle
 

Member Function Documentation

virtual bool SkPath1DPathEffect::filterPath ( SkPath dst,
const SkPath src,
SkStrokeRec ,
const SkRect cullR 
) const
overridevirtual

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.

Reimplemented from Sk1DPathEffect.

static sk_sp<SkPathEffect> SkPath1DPathEffect::Make ( const SkPath path,
SkScalar  advance,
SkScalar  phase,
Style   
)
static

Dash by replicating the specified path.

Parameters
pathThe path to replicate (dash)
advanceThe space between instances of path
phasedistance (mod advance) along path for its initial position
stylehow to transform path at each point (based on the current position and tangent)
SkScalar SkPath1DPathEffect::next ( SkPath dst,
SkScalar  dist,
SkPathMeasure  
) const
overrideprotectedvirtual

Called with the current distance along the path, with the current matrix for the point/tangent at the specified distance.

Return the distance to travel for the next call. If return <= 0, then that contour is done.

Implements Sk1DPathEffect.


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