#include <SkStrokeRec.h>
Definition at line 22 of file SkStrokeRec.h.
◆ InitStyle
Enumerator |
---|
kHairline_InitStyle | |
kFill_InitStyle | |
Definition at line 24 of file SkStrokeRec.h.
◆ Style
Enumerator |
---|
kHairline_Style | |
kFill_Style | |
kStroke_Style | |
kStrokeAndFill_Style | |
Definition at line 32 of file SkStrokeRec.h.
◆ SkStrokeRec() [1/3]
Definition at line 18 of file SkStrokeRec.cpp.
18 {
19 fResScale = 1;
24 fStrokeAndFill = false;
25}
#define SkPaintDefaults_MiterLimit
#define kStrokeRec_FillStyleWidth
@ kDefault_Cap
equivalent to kButt_Cap
@ kDefault_Join
equivalent to kMiter_Join
◆ SkStrokeRec() [2/3]
◆ SkStrokeRec() [3/3]
◆ applyToPaint()
void SkStrokeRec::applyToPaint |
( |
SkPaint * |
paint | ) |
const |
Apply these stroke parameters to a paint.
Definition at line 127 of file SkStrokeRec.cpp.
127 {
128 if (fWidth < 0) {
130 return;
131 }
132
134 paint->setStrokeWidth(fWidth);
135 paint->setStrokeMiter(fMiterLimit);
138}
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
@ kStrokeAndFill_Style
sets to stroke and fill geometry
◆ 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.
Definition at line 107 of file SkStrokeRec.cpp.
107 {
108 if (fWidth <= 0) {
109 return false;
110 }
111
118#ifdef SK_DEBUG
119 stroker.
setResScale(gDebugStrokerErrorSet ? gDebugStrokerError : fResScale);
120#else
122#endif
124 return true;
125}
void strokePath(const SkPath &path, SkPath *) const
void setCap(SkPaint::Cap)
void setDoFill(bool doFill)
void setResScale(SkScalar rs)
void setJoin(SkPaint::Join)
void setMiterLimit(SkScalar)
◆ getCap()
◆ 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.
Definition at line 140 of file SkStrokeRec.cpp.
140 {
142}
static SkScalar GetInflationRadius(const SkPaint &, SkPaint::Style)
◆ GetInflationRadius() [1/2]
Equivalent to: SkStrokeRec rec(paint, style); rec.getInflationRadius(); This does not account for other effects on the paint (i.e. path effect).
Definition at line 144 of file SkStrokeRec.cpp.
◆ GetInflationRadius() [2/2]
Definition at line 151 of file SkStrokeRec.cpp.
152 {
154 return 0;
156
157
158
160 }
161
162
165 multiplier =
std::max(multiplier, miterLimit);
166 }
169 }
171}
static const int strokeWidth
@ kMiter_Join
extends to miter limit
static float max(float r, float g, float b)
static SkString join(const CommandLineFlags::StringArray &)
◆ getJoin()
◆ getMiter()
SkScalar SkStrokeRec::getMiter |
( |
| ) |
const |
|
inline |
◆ getResScale()
SkScalar SkStrokeRec::getResScale |
( |
| ) |
const |
|
inline |
Definition at line 71 of file SkStrokeRec.h.
71 {
72 return fResScale;
73 }
◆ getStyle()
Definition at line 71 of file SkStrokeRec.cpp.
71 {
72 if (fWidth < 0) {
74 } else if (0 == fWidth) {
76 } else {
78 }
79}
◆ 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.
Definition at line 130 of file SkStrokeRec.h.
130 {
133 }
134 return fWidth == other.fWidth &&
136 fCap == other.fCap &&
137 fJoin == other.fJoin &&
138 fStrokeAndFill == other.fStrokeAndFill;
139 }
◆ isFillStyle()
bool SkStrokeRec::isFillStyle |
( |
| ) |
const |
|
inline |
◆ isHairlineStyle()
bool SkStrokeRec::isHairlineStyle |
( |
| ) |
const |
|
inline |
◆ needToApply()
bool SkStrokeRec::needToApply |
( |
| ) |
const |
|
inline |
◆ setFillStyle()
void SkStrokeRec::setFillStyle |
( |
| ) |
|
◆ setHairlineStyle()
void SkStrokeRec::setHairlineStyle |
( |
| ) |
|
Definition at line 86 of file SkStrokeRec.cpp.
86 {
87 fWidth = 0;
88 fStrokeAndFill = false;
89}
◆ setResScale()
void SkStrokeRec::setResScale |
( |
SkScalar |
rs | ) |
|
|
inline |
Definition at line 75 of file SkStrokeRec.h.
75 {
77 fResScale = rs;
78 }
SINT bool isfinite(const Vec< N, T > &v)
◆ setStrokeParams()
Definition at line 65 of file SkStrokeRec.h.
65 {
66 fCap = cap;
68 fMiterLimit = miterLimit;
69 }
◆ 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
Definition at line 91 of file SkStrokeRec.cpp.
91 {
92 if (strokeAndFill && (0 ==
width)) {
93
95 } else {
97 fStrokeAndFill = strokeAndFill;
98 }
99}
◆ kStyleCount
The documentation for this class was generated from the following files: