Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
SkPathEffect Class Reference

#include <SkPathEffect.h>

Inheritance diagram for SkPathEffect:
SkFlattenable SkRefCnt SkRefCntBase SkPathEffectBase Sk1DPathEffect Sk2DPathEffect SkCornerPathEffectImpl SkDashImpl SkDiscretePathEffectImpl SkPairPathEffect SkTrimPE SkPath1DPathEffectImpl SkLine2DPathEffectImpl SkPath2DPathEffectImpl SkComposePathEffect SkSumPathEffect

Classes

struct  DashInfo
 

Public Types

enum  DashType { kNone_DashType , kDash_DashType }
 
- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type ,
  kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 

Public Member Functions

DashType asADash (DashInfo *info) const
 
bool filterPath (SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *cullR) const
 
bool filterPath (SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *cullR, const SkMatrix &ctm) const
 
bool needsCTM () const
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
virtual void flatten (SkWriteBuffer &) const
 
virtual Type getFlattenableType () const =0
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< SkPathEffectMakeSum (sk_sp< SkPathEffect > first, sk_sp< SkPathEffect > second)
 
static sk_sp< SkPathEffectMakeCompose (sk_sp< SkPathEffect > outer, sk_sp< SkPathEffect > inner)
 
static SkFlattenable::Type GetFlattenableType ()
 
static sk_sp< SkPathEffectDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
- Static Public Member Functions inherited from SkFlattenable
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 

Friends

class SkPathEffectBase
 

Detailed Description

SkPathEffect is the base class for objects in the SkPaint that affect the geometry of a drawing primitive before it is transformed by the canvas' matrix and drawn.

Dashing is implemented as a subclass of SkPathEffect.

Definition at line 35 of file SkPathEffect.h.

Member Enumeration Documentation

◆ DashType

Enumerator
kNone_DashType 

ignores the info parameter

kDash_DashType 

fills in all of the info parameter

Definition at line 60 of file SkPathEffect.h.

60 {
61 kNone_DashType, //!< ignores the info parameter
62 kDash_DashType, //!< fills in all of the info parameter
63 };
@ kNone_DashType
ignores the info parameter
@ kDash_DashType
fills in all of the info parameter

Member Function Documentation

◆ asADash()

SkPathEffect::DashType SkPathEffect::asADash ( DashInfo info) const

Definition at line 52 of file SkPathEffect.cpp.

52 {
53 return as_PEB(this)->onAsADash(info);
54}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
static SkPathEffectBase * as_PEB(SkPathEffect *effect)
virtual DashType onAsADash(DashInfo *) const

◆ Deserialize()

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

Definition at line 220 of file SkPathEffect.cpp.

221 {
222 return sk_sp<SkPathEffect>(static_cast<SkPathEffect*>(
224 kSkPathEffect_Type, data, size, procs).release()));
225}
static sk_sp< SkFlattenable > Deserialize(Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)

◆ filterPath() [1/2]

bool SkPathEffect::filterPath ( SkPath dst,
const SkPath src,
SkStrokeRec rec,
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. 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.

Definition at line 27 of file SkPathEffect.cpp.

28 {
29 return this->filterPath(dst, src, rec, bounds, SkMatrix::I());
30}
static const SkMatrix & I()
bool filterPath(SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *cullR) const

◆ filterPath() [2/2]

bool SkPathEffect::filterPath ( SkPath dst,
const SkPath src,
SkStrokeRec rec,
const SkRect cullR,
const SkMatrix ctm 
) const

Version of filterPath that can be called when the CTM is known.

Definition at line 32 of file SkPathEffect.cpp.

33 {
34 SkPath tmp, *tmpDst = dst;
35 if (dst == &src) {
36 tmpDst = &tmp;
37 }
38 if (as_PEB(this)->onFilterPath(tmpDst, src, rec, bounds, ctm)) {
39 if (dst == &src) {
40 *dst = tmp;
41 }
42 return true;
43 }
44 return false;
45}
dst
Definition cp.py:12

◆ GetFlattenableType()

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

Definition at line 54 of file SkPathEffect.h.

54 {
55 return kSkPathEffect_Type;
56 }

◆ MakeCompose()

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

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

Definition at line 210 of file SkPathEffect.cpp.

211 {
212 return SkComposePathEffect::Make(std::move(outer), std::move(inner));
213}
static sk_sp< SkPathEffect > Make(sk_sp< SkPathEffect > outer, sk_sp< SkPathEffect > inner)

◆ MakeSum()

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

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)

Definition at line 206 of file SkPathEffect.cpp.

206 {
207 return SkSumPathEffect::Make(std::move(first), std::move(second));
208}
static sk_sp< SkPathEffect > Make(sk_sp< SkPathEffect > first, sk_sp< SkPathEffect > second)

◆ needsCTM()

bool SkPathEffect::needsCTM ( ) const

True if this path effect requires a valid CTM

Definition at line 56 of file SkPathEffect.cpp.

56 {
57 return as_PEB(this)->onNeedsCTM();
58}
virtual bool onNeedsCTM() const

Friends And Related Symbol Documentation

◆ SkPathEffectBase

friend class SkPathEffectBase
friend

Definition at line 108 of file SkPathEffect.h.


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