APIdia Launch Partner
Top Constructors Methods
com.sun.javafx.util

public final Class InterpolationUtils

extends Object
Class Inheritance
Imports
com.sun.javafx.UnmodifiableArrayList, javafx.animation.Interpolatable, javafx.scene.paint.Color, .ImagePattern, .LinearGradient, .Paint, .RadialGradient, .Stop, java.lang.reflect.Array, java.util.List, .Objects

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static double
interpolate(double from, double to, double t)

Utility function that interpolates between two double values.

public static <T extends Interpolatable<T>> T[][]

Returns:

the intermediate array series
interpolateArraySeriesPairwise
(T[][]
the first array series, not null
firstArraySeries
,
T[][]
the second array series, not null
secondArraySeries
,
double t)

Computes an intermediate array series that consists of the pairwise interpolation between two array series, using the same rules as described in interpolateArraysPairwise.

public static <T extends Interpolatable<T>> T[]

Returns:

the intermediate list
interpolateArraysPairwise
(T[]
the first array, not null
firstArray
,
T[]
the second array, not null
secondArray
,
double t)

Computes an intermediate array that consists of the pairwise interpolation between two arrays, using the following rules:

  1. The size of the returned array corresponds to the size of the second array.
  2. If the first array has fewer elements than the second array, the missing elements are copied from the second array.
  3. If the first array has more elements than the second array, the excess elements are discarded.
  4. If the intermediate array is shallow-equal to the first array passed into the method (i.e. its elements are references to the same objects), the existing array is returned.
public static <T> T
interpolateDiscrete(T from, T to, double t)

Utility function that interpolates between two discrete values, returning from when t < 0.5, and to otherwise.

public static double
interpolateDiscrete(double from, double to, double t)

Utility function that interpolates between two discrete values, returning from when t < 0.5, and to otherwise.

private static <T extends Interpolatable<T>> T[]
interpolateEquisizedArraysPairwise(T[] firstArray, T[] secondArray, double t)

Computes an intermediate array that consists of the pairwise interpolation between two arrays of equal size, each containing up to 8 elements.

private static <T extends Interpolatable<T>> List<T>
interpolateEquisizedListsPairwise(List<T> firstList, List<T> secondList, double t)

Computes an intermediate list that consists of the pairwise interpolation between two lists of equal size, each containing up to 8 elements.

public static <T extends Interpolatable<T>> List<T>

Returns:

the intermediate list
interpolateListsPairwise
(List<T>
the first list, not null
firstList
,
List<T>
the second list, not null
secondList
,
double t)

Computes an intermediate list that consists of the pairwise interpolation between two lists, using the following rules:

  1. The size of the returned list corresponds to the size of the second list.
  2. If the first list has fewer elements than the second list, the missing elements are copied from the second list.
  3. If the first list has more elements than the second list, the excess elements are discarded.
  4. If the intermediate list is shallow-equal to the first list passed into the method (i.e. its elements are references to the same objects), the existing list is returned.
  5. If a new list is returned, it is unmodifiable.
public static Paint
interpolatePaint(Paint startValue, Paint endValue, double t)

Interpolates between potentially different types of paint.

public static LinearGradient
newSolidGradient(LinearGradient source, Color color)

Creates a new linear gradient that consists of two stops with the same color.

public static RadialGradient
newSolidGradient(RadialGradient source, Color color)

Creates a new radial gradient that consists of two stops with the same color.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

InterpolationUtilsback to summary
private InterpolationUtils()

Method Detail

interpolateback to summary
public static double interpolate(double from, double to, double t)

Utility function that interpolates between two double values.

interpolateArraySeriesPairwiseback to summary
public static <T extends Interpolatable<T>> T[][] interpolateArraySeriesPairwise(T[][] firstArraySeries, T[][] secondArraySeries, double t)

Computes an intermediate array series that consists of the pairwise interpolation between two array series, using the same rules as described in interpolateArraysPairwise.

This method preferably returns existing array instances (i.e. the firstArraySeries or secondArraySeries arguments) as an indication to the caller that the result is shallow-equal to either of the input arguments. Callers might depend on this behavior to optimize their own object allocation strategy by quickly detecting whether anything has changed at all.

Parameters
firstArraySeries:T[][]

the first array series, not null

secondArraySeries:T[][]

the second array series, not null

Returns:T[][]

the intermediate array series

interpolateArraysPairwiseback to summary
public static <T extends Interpolatable<T>> T[] interpolateArraysPairwise(T[] firstArray, T[] secondArray, double t)

Computes an intermediate array that consists of the pairwise interpolation between two arrays, using the following rules:

  1. The size of the returned array corresponds to the size of the second array.
  2. If the first array has fewer elements than the second array, the missing elements are copied from the second array.
  3. If the first array has more elements than the second array, the excess elements are discarded.
  4. If the intermediate array is shallow-equal to the first array passed into the method (i.e. its elements are references to the same objects), the existing array is returned.
This method preferably returns existing array instances (i.e. the firstArray or secondArray arguments) as an indication to the caller that the result is shallow-equal to either of the input arguments. Callers might depend on this behavior to optimize their own object allocation strategy by quickly detecting whether anything has changed at all.
Parameters
firstArray:T[]

the first array, not null

secondArray:T[]

the second array, not null

Returns:T[]

the intermediate list

interpolateDiscreteback to summary
public static <T> T interpolateDiscrete(T from, T to, double t)

Utility function that interpolates between two discrete values, returning from when t < 0.5, and to otherwise.

interpolateDiscreteback to summary
public static double interpolateDiscrete(double from, double to, double t)

Utility function that interpolates between two discrete values, returning from when t < 0.5, and to otherwise.

interpolateEquisizedArraysPairwiseback to summary
private static <T extends Interpolatable<T>> T[] interpolateEquisizedArraysPairwise(T[] firstArray, T[] secondArray, double t)

Computes an intermediate array that consists of the pairwise interpolation between two arrays of equal size, each containing up to 8 elements.

This method is an optimization: it does not allocate memory when the intermediate array is shallow-equal to the array that is passed into this method, i.e. its elements are references to the same objects. The existing array is returned in this case.

interpolateEquisizedListsPairwiseback to summary
private static <T extends Interpolatable<T>> List<T> interpolateEquisizedListsPairwise(List<T> firstList, List<T> secondList, double t)

Computes an intermediate list that consists of the pairwise interpolation between two lists of equal size, each containing up to 8 elements.

This method is an optimization: it does not allocate memory when the intermediate list is shallow-equal to the list that is passed into this method, i.e. its elements are references to the same objects. The existing list is returned in this case.

interpolateListsPairwiseback to summary
public static <T extends Interpolatable<T>> List<T> interpolateListsPairwise(List<T> firstList, List<T> secondList, double t)

Computes an intermediate list that consists of the pairwise interpolation between two lists, using the following rules:

  1. The size of the returned list corresponds to the size of the second list.
  2. If the first list has fewer elements than the second list, the missing elements are copied from the second list.
  3. If the first list has more elements than the second list, the excess elements are discarded.
  4. If the intermediate list is shallow-equal to the first list passed into the method (i.e. its elements are references to the same objects), the existing list is returned.
  5. If a new list is returned, it is unmodifiable.
This method preferably returns existing list instances (i.e. the firstList or secondList arguments) as an indication to the caller that the result is shallow-equal to either of the input arguments. Callers might depend on this behavior to optimize their own object allocation strategy by quickly detecting whether anything has changed at all.
Parameters
firstList:List<T>

the first list, not null

secondList:List<T>

the second list, not null

Returns:List<T>

the intermediate list

interpolatePaintback to summary
public static Paint interpolatePaint(Paint startValue, Paint endValue, double t)

Interpolates between potentially different types of paint.

In addition to homogeneous interpolations between paints of the same type, the following heterogeneous interpolations are supported:

  • Color ↔ LinearGradient
  • Color ↔ RadialGradient
If a paint is not interpolatable, startValue is returned for t < 0.5, and endValue is returned otherwise.
newSolidGradientback to summary
public static LinearGradient newSolidGradient(LinearGradient source, Color color)

Creates a new linear gradient that consists of two stops with the same color.

newSolidGradientback to summary
public static RadialGradient newSolidGradient(RadialGradient source, Color color)

Creates a new radial gradient that consists of two stops with the same color.