Package icyllis.arc3d.core
Class StrokeRec
java.lang.Object
icyllis.arc3d.core.StrokeRec
This class collects stroke params from paint and constructs new paths
by stroking geometries.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionA fill style.Create from paint, assuming resScale = 1.Create from paint.Create from paint with overrides, assuming resScale = 1.Create from paint with overrides. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyToPaint
(Paint paint) Apply these stroke parameters to a paint.boolean
applyToPath
(PathIterable src, PathConsumer dst) Apply these stroke parameters to the src path, emitting the result to dst.int
getAlign()
int
getCap()
float
Gives a conservative value for the outset that should be applied to a geometries bounds to account for any inflation due to applying this stroke to the geometry.static float
getInflationRadius
(float strokeWidth, int cap, int join, int align, float miterLimit) int
getJoin()
float
float
ResScale is the "intended" resolution for the output.
Default is 1.0.
Larger values (res > 1) indicate that the result should be more precise, since it will be zoomed up, and small errors will be magnified.
Smaller values (0 invalid input: '<' res invalid input: '<' 1) indicate that the result can be less precise, since it will be zoomed down, and small errors may be invisible.int
getStyle()
float
getWidth()
boolean
hasSameEffect
(StrokeRec other) Compare if two Strokes have an equal effect on a path.void
boolean
boolean
boolean
Returns true if this represents any thick stroking, i.e.void
setAlign
(int align) void
setCap
(int cap) void
void
void
setJoin
(int join) void
setMiterLimit
(float miterLimit) void
setResScale
(float resScale) void
setStrokeParams
(int cap, int join, int align, float miterLimit) void
setStrokeStyle
(float width, boolean strokeAndFill) Specify the strokewidth, and optionally if you want stroke + fill.void
setWidth
(float width)
-
Field Details
-
kHairline_Style
public static final int kHairline_Style- See Also:
-
kFill_Style
public static final int kFill_Style- See Also:
-
kStroke_Style
public static final int kStroke_Style- See Also:
-
kStrokeAndFill_Style
public static final int kStrokeAndFill_Style- See Also:
-
-
Constructor Details
-
StrokeRec
public StrokeRec()A fill style. -
StrokeRec
Create from paint, assuming resScale = 1. -
StrokeRec
Create from paint. -
StrokeRec
Create from paint with overrides, assuming resScale = 1. -
StrokeRec
Create from paint with overrides.
-
-
Method Details
-
init
-
getStyle
public int getStyle() -
isFillStyle
public boolean isFillStyle() -
isHairlineStyle
public boolean isHairlineStyle() -
isStrokeStyle
public boolean isStrokeStyle()Returns true if this represents any thick stroking, i.e. applyToPath() will return true. -
setFillStyle
public void setFillStyle() -
setHairlineStyle
public void setHairlineStyle() -
setStrokeStyle
public void setStrokeStyle(float width, boolean strokeAndFill) 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 -
getWidth
public float getWidth() -
setWidth
public void setWidth(float width) -
getCap
public int getCap() -
getJoin
public int getJoin() -
getAlign
public int getAlign() -
getMiterLimit
public float getMiterLimit() -
setCap
public void setCap(int cap) -
setJoin
public void setJoin(int join) -
setAlign
public void setAlign(int align) -
setMiterLimit
public void setMiterLimit(float miterLimit) -
setStrokeParams
public void setStrokeParams(int cap, int join, int align, float miterLimit) -
getResScale
public float getResScale()ResScale is the "intended" resolution for the output.
Default is 1.0.
Larger values (res > 1) indicate that the result should be more precise, since it will be zoomed up, and small errors will be magnified.
Smaller values (0 invalid input: '<' res invalid input: '<' 1) indicate that the result can be less precise, since it will be zoomed down, and small errors may be invisible. -
setResScale
public void setResScale(float resScale) -
applyToPath
Apply these stroke parameters to the src path, emitting the result to 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 emitted to dst.
src and dst must NOT come from the same object.
-
applyToPaint
Apply these stroke parameters to a paint. -
getInflationRadius
public float getInflationRadius()Gives a conservative value for the outset that should be applied to a geometries bounds to account for any inflation due to applying this stroke to the geometry. -
hasSameEffect
Compare if two Strokes have an equal effect on a path. Equal Strokes produce equal paths. Equality of produced paths does not take the ResScale parameter into account. -
getInflationRadius
public static float getInflationRadius(float strokeWidth, int cap, int join, int align, float miterLimit)
-