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

Public Types

enum  InitStyle { kHairline_InitStyle, kFill_InitStyle }
 
enum  Style { kHairline_Style, kFill_Style, kStroke_Style, kStrokeAndFill_Style }
 
enum  { kStyleCount = kStrokeAndFill_Style + 1 }
 

Public Member Functions

 SkStrokeRec (InitStyle style)
 
 SkStrokeRec (const SkPaint &, SkPaint::Style, SkScalar resScale=1)
 
 SkStrokeRec (const SkPaint &, SkScalar resScale=1)
 
Style getStyle () const
 
SkScalar getWidth () const
 
SkScalar getMiter () const
 
SkPaint::Cap getCap () const
 
SkPaint::Join getJoin () const
 
bool isHairlineStyle () const
 
bool isFillStyle () const
 
void setFillStyle ()
 
void setHairlineStyle ()
 
void setStrokeStyle (SkScalar width, bool strokeAndFill=false)
 Specify the strokewidth, and optionally if you want stroke + fill. More...
 
void setStrokeParams (SkPaint::Cap cap, SkPaint::Join join, SkScalar miterLimit)
 
SkScalar getResScale () const
 
void setResScale (SkScalar rs)
 
bool needToApply () const
 Returns true if this specifes any thick stroking, i.e. More...
 
bool applyToPath (SkPath *dst, const SkPath &src) const
 Apply these stroke parameters to the src path, returning the result in dst. More...
 
void applyToPaint (SkPaint *paint) const
 Apply these stroke parameters to a paint.
 
SkScalar getInflationRadius () const
 Gives a conservative value for the outset that should applied to a geometries bounds to account for any inflation due to applying this strokeRec to the geometry.
 
bool hasEqualEffect (const SkStrokeRec &other) const
 Compare if two SkStrokeRecs have an equal effect on a path. More...
 

Static Public Member Functions

static SkScalar GetInflationRadius (const SkPaint &, SkPaint::Style)
 Equivalent to: SkStrokeRec rec(paint, style); rec.getInflationRadius(); This does not account for other effects on the paint (i.e. More...
 

Private Member Functions

void init (const SkPaint &, SkPaint::Style, SkScalar resScale)
 

Private Attributes

SkScalar fResScale
 
SkScalar fWidth
 
SkScalar fMiterLimit
 
uint32_t fCap: 16
 
uint32_t fJoin: 15
 
uint32_t fStrokeAndFill: 1
 

Member Function Documentation

bool SkStrokeRec::applyToPath ( SkPath dst,
const SkPath src 
) const

Apply these stroke parameters to the src path, returning the result in dst.

If there was no change (i.e. style == hairline or fill) this returns false and dst is unchanged. Otherwise returns true and the result is stored in dst.

src and dst may be the same path.

static SkScalar SkStrokeRec::GetInflationRadius ( const SkPaint ,
SkPaint::Style   
)
static

Equivalent to: SkStrokeRec rec(paint, style); rec.getInflationRadius(); This does not account for other effects on the paint (i.e.

path effect).

bool SkStrokeRec::hasEqualEffect ( const SkStrokeRec other) const
inline

Compare if two SkStrokeRecs have an equal effect on a path.

Equal SkStrokeRecs produce equal paths. Equality of produced paths does not take the ResScale parameter into account.

bool SkStrokeRec::needToApply ( ) const
inline

Returns true if this specifes any thick stroking, i.e.

applyToPath() will return true.

void SkStrokeRec::setStrokeStyle ( SkScalar  width,
bool  strokeAndFill = false 
)

Specify the strokewidth, and optionally if you want stroke + fill.

Note, if width==0, then this request is taken to mean: strokeAndFill==true -> new style will be Fill strokeAndFill==false -> new style will be Hairline


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