Package icyllis.modernui.graphics

# Class AngularGradient

java.lang.Object
icyllis.modernui.graphics.Shader
icyllis.modernui.graphics.GradientShader
icyllis.modernui.graphics.AngularGradient

public class AngularGradient extends GradientShader
AngularGradient generates gradient colors linearly interpolated in the angular direction of a circle, also known as sweep gradient, conic gradient.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `AngularGradient.Builder`
  Builder pattern of `AngularGradient`.

  ## Nested classes/interfaces inherited from class icyllis.modernui.graphics.GradientShader

  `GradientShader.HueInterpolationMethod, GradientShader.InterpolationColorSpace`

  ## Nested classes/interfaces inherited from class icyllis.modernui.graphics.Shader

  `Shader.TileMode`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AngularGradient(float centerX, float centerY, float startAngle, float endAngle, float[] colors, ColorSpace colorSpace, float[] positions, Shader.TileMode tileMode, Matrix localMatrix)`
  Create an angular gradient shader.
  `AngularGradient(float centerX, float centerY, float startAngle, float endAngle, int[] colors, float[] positions, Shader.TileMode tileMode, Matrix localMatrix)`
  Simplified constructor that takes an array of 0xAARRGGBB colors in sRGB color space.
  `AngularGradient(float centerX, float centerY, float startAngle, float endAngle, int centerColor, int edgeColor, Shader.TileMode tileMode, Matrix localMatrix)`
  Simplified constructor that takes two 0xAARRGGBB colors in sRGB color space.
  `AngularGradient(float centerX, float centerY, int[] colors, float[] positions, Matrix localMatrix)`
  Simplified constructor that takes an array of 0xAARRGGBB colors in sRGB color space, and uses a full circle.
  `AngularGradient(float centerX, float centerY, int startColor, int endColor, Matrix localMatrix)`
  Simplified constructor that takes two 0xAARRGGBB colors in sRGB color space, and uses a full circle.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `getLocalMatrix(Matrix localMatrix)`
  Return true if the shader has a non-identity local matrix.

  ### Methods inherited from class icyllis.modernui.graphics.GradientShader

  `convertColors`

  ### Methods inherited from class icyllis.modernui.graphics.Shader

  `release`

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

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

- ## Constructor Details

  - ### AngularGradient

    public AngularGradient(float centerX, float centerY, @ColorInt int startColor, @ColorInt int endColor, @Nullable Matrix localMatrix)
    Simplified constructor that takes two 0xAARRGGBB colors in sRGB color space, and uses a full circle.
    See Also:
      - `AngularGradient(float, float, float, float, float[], ColorSpace, float[], TileMode, Matrix)`

  - ### AngularGradient

    public AngularGradient(float centerX, float centerY, @NonNull @ColorInt int[] colors, @Nullable float[] positions, @Nullable Matrix localMatrix)
    Simplified constructor that takes an array of 0xAARRGGBB colors in sRGB color space, and uses a full circle.
    See Also:
      - `AngularGradient(float, float, float, float, float[], ColorSpace, float[], TileMode, Matrix)`

  - ### AngularGradient

    public AngularGradient(float centerX, float centerY, float startAngle, float endAngle, @ColorInt int centerColor, @ColorInt int edgeColor, @NonNull Shader.TileMode tileMode, @Nullable Matrix localMatrix)
    Simplified constructor that takes two 0xAARRGGBB colors in sRGB color space.
    See Also:
      - `AngularGradient(float, float, float, float, float[], ColorSpace, float[], TileMode, Matrix)`

  - ### AngularGradient

    public AngularGradient(float centerX, float centerY, float startAngle, float endAngle, @NonNull @ColorInt int[] colors, @Nullable float[] positions, @NonNull Shader.TileMode tileMode, @Nullable Matrix localMatrix)
    Simplified constructor that takes an array of 0xAARRGGBB colors in sRGB color space.
    See Also:
      - `AngularGradient(float, float, float, float, float[], ColorSpace, float[], TileMode, Matrix)`

  - ### AngularGradient

    public AngularGradient(float centerX, float centerY, float startAngle, float endAngle, @Size(multiple=4L) @NonNull float[] colors, @Nullable ColorSpace colorSpace, @Nullable float[] positions, @NonNull Shader.TileMode tileMode, @Nullable Matrix localMatrix)
    Create an angular gradient shader.

    The shader accepts negative angles and angles larger than 360, draws between 0 and 360 degrees, similar to the CSS conic-gradient semantics. 0 degrees means horizontal positive x-axis. The start angle must be less than the end angle, otherwise a null pointer is returned. If color stops do not contain 0 and 1 but are within this range, the respective outer color stop is repeated for 0 and 1. Color stops less than 0 are clamped to 0, and greater than 1 are clamped to 1.

    The colors array holds repeated R,G,B,A values of source colors to interpolate, they have non-premultiplied alpha and are in the given colorSpace.

    The positions array specifies a number of stops, all values are between 0 and 1 and monotonic increasing. Colors will be linearly interpolated in each stop. Null means that they are uniformly distributed. If the first position is not 0 or the last position is not 1, an implicit stop will be added.

    The tileMode specifies the behavior when local coords are out of bounds.

    The localMatrix specifies an additional local matrix for this gradient, it transforms gradient's local coordinates to geometry's local coordinates, null means identity.

    All given arguments will be simplified and copied into the return shader.

    Parameters:
      `centerX` - x of center point
      `centerY` - y of center point
      `startAngle` - start angle in degrees
      `endAngle` - end angle in degrees
      `colors` - color array
      `colorSpace` - color space, null will use the default one (sRGB)
      `positions` - position array
      `tileMode` - tile mode
      `localMatrix` - local matrix
    Throws:
      `IllegalArgumentException` - NaN, infinity, non-invertible matrix, etc.

- ## Method Details

  - ### getLocalMatrix

    public boolean getLocalMatrix(@NonNull Matrix localMatrix)
    Return true if the shader has a non-identity local matrix.
    Parameters:
      `localMatrix` - Set to the local matrix of the shader, if the shader's matrix is non-null.
    Returns:
      true if the shader has a non-identity local matrix