Skia
2D Graphics Library
SkStrokeRec Class Reference

#include <SkStrokeRec.h>

Public Types

enum  InitStyle { kHairline_InitStyle, kFill_InitStyle }
 
enum  Style { kHairline_Style, kFill_Style, kStroke_Style, kStrokeAndFill_Style }
 

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. More...
 
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. More...
 
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...
 
static SkScalar GetInflationRadius (SkPaint::Join, SkScalar miterLimit, SkPaint::Cap, SkScalar strokeWidth)
 

Static Public Attributes

static constexpr int kStyleCount = kStrokeAndFill_Style + 1
 

Member Enumeration Documentation

◆ InitStyle

Enumerator
kHairline_InitStyle 
kFill_InitStyle 

◆ Style

Enumerator
kHairline_Style 
kFill_Style 
kStroke_Style 
kStrokeAndFill_Style 

Constructor & Destructor Documentation

◆ SkStrokeRec() [1/3]

SkStrokeRec::SkStrokeRec ( InitStyle  style)

◆ SkStrokeRec() [2/3]

SkStrokeRec::SkStrokeRec ( const SkPaint ,
SkPaint::Style  ,
SkScalar  resScale = 1 
)

◆ SkStrokeRec() [3/3]

SkStrokeRec::SkStrokeRec ( const SkPaint ,
SkScalar  resScale = 1 
)
explicit

Member Function Documentation

◆ applyToPaint()

void SkStrokeRec::applyToPaint ( SkPaint paint) const

Apply these stroke parameters to a paint.

◆ applyToPath()

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.

◆ getCap()

SkPaint::Cap SkStrokeRec::getCap ( ) const
inline

◆ getInflationRadius()

SkScalar SkStrokeRec::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.

◆ GetInflationRadius() [1/2]

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

◆ GetInflationRadius() [2/2]

static SkScalar SkStrokeRec::GetInflationRadius ( SkPaint::Join  ,
SkScalar  miterLimit,
SkPaint::Cap  ,
SkScalar  strokeWidth 
)
static

◆ getJoin()

SkPaint::Join SkStrokeRec::getJoin ( ) const
inline

◆ getMiter()

SkScalar SkStrokeRec::getMiter ( ) const
inline

◆ getResScale()

SkScalar SkStrokeRec::getResScale ( ) const
inline

◆ getStyle()

Style SkStrokeRec::getStyle ( ) const

◆ getWidth()

SkScalar SkStrokeRec::getWidth ( ) const
inline

◆ hasEqualEffect()

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.

◆ isFillStyle()

bool SkStrokeRec::isFillStyle ( ) const
inline

◆ isHairlineStyle()

bool SkStrokeRec::isHairlineStyle ( ) const
inline

◆ needToApply()

bool SkStrokeRec::needToApply ( ) const
inline

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

applyToPath() will return true.

◆ setFillStyle()

void SkStrokeRec::setFillStyle ( )

◆ setHairlineStyle()

void SkStrokeRec::setHairlineStyle ( )

◆ setResScale()

void SkStrokeRec::setResScale ( SkScalar  rs)
inline

◆ setStrokeParams()

void SkStrokeRec::setStrokeParams ( SkPaint::Cap  cap,
SkPaint::Join  join,
SkScalar  miterLimit 
)
inline

◆ setStrokeStyle()

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

Member Data Documentation

◆ kStyleCount

constexpr int SkStrokeRec::kStyleCount = kStrokeAndFill_Style + 1
staticconstexpr

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