Package icyllis.arc3d.sketch
Class StrokeRec
java.lang.Object
icyllis.arc3d.sketch.StrokeRec
This class collects stroke params from paint and constructs new paths
by stroking geometries.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionA 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 TypeMethodDescriptionvoidapplyToPaint(Paint paint) Apply these stroke parameters to a paint.booleanapplyToPath(Shape src, PathConsumer dst) Apply these stroke parameters to the src path, emitting the result to dst.intgetAlign()intgetCap()floatGives 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 floatgetInflationRadius(float strokeWidth, int cap, int join, int align, float miterLimit) intgetJoin()floatfloatResScale 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.intgetStyle()floatgetWidth()booleanhasSameEffect(StrokeRec other) Compare if two Strokes have an equal effect on a path.voidbooleanbooleanbooleanReturns true if this represents any thick stroking, i.e.voidsetAlign(int align) voidsetCap(int cap) voidvoidvoidsetJoin(int join) voidsetMiterLimit(float miterLimit) voidsetResScale(float resScale) voidsetStrokeParams(int cap, int join, int align, float miterLimit) voidsetStrokeStyle(float width, boolean strokeAndFill) Specify the strokewidth, and optionally if you want stroke + fill.voidsetWidth(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)
-