Package icyllis.arc3d.core

# 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 Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `kFill_Style`
  `static final int`
  `kHairline_Style`
  `static final int`
  `kStroke_Style`
  `static final int`
  `kStrokeAndFill_Style`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StrokeRec()`
  A fill style.
  `StrokeRec(Paint paint)`
  Create from paint, assuming resScale = 1.
  `StrokeRec(Paint paint, float resScale)`
  Create from paint.
  `StrokeRec(Paint paint, int style, float width)`
  Create from paint with overrides, assuming resScale = 1.
  `StrokeRec(Paint paint, int style, float width, float resScale)`
  Create from paint with overrides.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `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`
  `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.
  `static float`
  `getInflationRadius(float strokeWidth, int cap, int join, int align, float miterLimit)`
  `int`
  `getJoin()`
  `float`
  `getMiterLimit()`
  `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.
  `int`
  `getStyle()`
  `float`
  `getWidth()`
  `boolean`
  `hasSameEffect(StrokeRec other)`
  Compare if two Strokes have an equal effect on a path.
  `void`
  `init(Paint paint, int style, float width, float resScale)`
  `boolean`
  `isFillStyle()`
  `boolean`
  `isHairlineStyle()`
  `boolean`
  `isStrokeStyle()`
  Returns true if this represents any thick stroking, i.e.
  `void`
  `setAlign(int align)`
  `void`
  `setCap(int cap)`
  `void`
  `setFillStyle()`
  `void`
  `setHairlineStyle()`
  `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)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### kHairline_Style

    public static final int kHairline_Style
    See Also:
      - Constant Field Values

  - ### kFill_Style

    public static final int kFill_Style
    See Also:
      - Constant Field Values

  - ### kStroke_Style

    public static final int kStroke_Style
    See Also:
      - Constant Field Values

  - ### kStrokeAndFill_Style

    public static final int kStrokeAndFill_Style
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### StrokeRec

    public StrokeRec()
    A fill style.

  - ### StrokeRec

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

  - ### StrokeRec

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

  - ### StrokeRec

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

  - ### StrokeRec

    public StrokeRec(Paint paint, int style, float width, float resScale)
    Create from paint with overrides.

- ## Method Details

  - ### init

    public void init(Paint paint, int style, float width, float resScale)

  - ### 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

    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

    public void applyToPaint(Paint paint)
    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

    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

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