Class StrokeRec

java.lang.Object
icyllis.arc3d.core.StrokeRec

public class StrokeRec extends Object
This class collects stroke params from paint and constructs new paths by stroking geometries.
  • Field Details Link icon

  • Constructor Details Link icon

    • StrokeRec Link icon

      public StrokeRec()
      A fill style.
    • StrokeRec Link icon

      public StrokeRec(Paint paint)
      Create from paint, assuming resScale = 1.
    • StrokeRec Link icon

      public StrokeRec(Paint paint, float resScale)
      Create from paint.
    • StrokeRec Link icon

      public StrokeRec(Paint paint, int style, float width)
      Create from paint with overrides, assuming resScale = 1.
    • StrokeRec Link icon

      public StrokeRec(Paint paint, int style, float width, float resScale)
      Create from paint with overrides.
  • Method Details Link icon

    • init Link icon

      public void init(Paint paint, int style, float width, float resScale)
    • getStyle Link icon

      public int getStyle()
    • isFillStyle Link icon

      public boolean isFillStyle()
    • isHairlineStyle Link icon

      public boolean isHairlineStyle()
    • isStrokeStyle Link icon

      public boolean isStrokeStyle()
      Returns true if this represents any thick stroking, i.e. applyToPath() will return true.
    • setFillStyle Link icon

      public void setFillStyle()
    • setHairlineStyle Link icon

      public void setHairlineStyle()
    • setStrokeStyle Link icon

      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 Link icon

      public float getWidth()
    • setWidth Link icon

      public void setWidth(float width)
    • getCap Link icon

      public int getCap()
    • getJoin Link icon

      public int getJoin()
    • getAlign Link icon

      public int getAlign()
    • getMiterLimit Link icon

      public float getMiterLimit()
    • setCap Link icon

      public void setCap(int cap)
    • setJoin Link icon

      public void setJoin(int join)
    • setAlign Link icon

      public void setAlign(int align)
    • setMiterLimit Link icon

      public void setMiterLimit(float miterLimit)
    • setStrokeParams Link icon

      public void setStrokeParams(int cap, int join, int align, float miterLimit)
    • getResScale Link icon

      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 Link icon

      public void setResScale(float resScale)
    • applyToPath Link icon

      public boolean applyToPath(PathIterable src, PathConsumer dst)
      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 Link icon

      public void applyToPaint(Paint paint)
      Apply these stroke parameters to a paint.
    • getInflationRadius Link icon

      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 Link icon

      public boolean hasSameEffect(StrokeRec other)
      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 Link icon

      public static float getInflationRadius(float strokeWidth, int cap, int join, int align, float miterLimit)