Class RadialGradient

All Implemented Interfaces:
RefCounted, Shader

public final class RadialGradient extends Gradient1DShader
  • Constructor Details

    • RadialGradient

      @VisibleForTesting public RadialGradient(float centerX, float centerY, float radius, @Nonnull float[] colors, @Nullable ColorSpace colorSpace, @Nullable float[] positions, int colorCount, int tileMode, int interpolation)
  • Method Details

    • make

      @CheckReturnValue @Nullable @SharedPtr public static @SharedPtr Shader make(float centerX, float centerY, float radius, @Nonnull float[] colors, @Nullable ColorSpace colorSpace, @Nullable float[] positions, int colorCount, int tileMode, int interpolation, @Nullable Matrixc localMatrix)
      Create a radial gradient shader.

      The colors array holds repeated R,G,B,A values of source colors to interpolate, they are un-premultiplied and 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.

      Only the first colorCount entries in array will be taken, then colors.length >= colorCount * 4 invalid input: '&'invalid input: '&' positions.length >= colorCount.

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

      The interpolation specifies the color interpolation method, see GradientShader.Interpolation.

      The localMatrix specifies an additional local matrix for this gradient, null means identity.

      All given arguments will be simplified and copied into the return shader. Null is returned if there are any illegal arguments (NaN, Inf, non-invertible matrix, etc.).

      Parameters:
      centerX - x of center point
      centerY - y of center point
      radius - radius of circle
      colors - color array
      colorSpace - color space, null will use the default one (sRGB)
      positions - position array
      colorCount - number of stops
      tileMode - tile mode
      interpolation - interpolation method
      localMatrix - local matrix
      Returns:
      a gradient shader, or degenerate shader, or null
    • asGradient

      public int asGradient()
    • getCenterX

      public float getCenterX()
    • getCenterY

      public float getCenterY()
    • getRadius

      public float getRadius()