APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.paint

public final Class Stop

extends Object
implements Interpolatable<Stop>
Class Inheritance
All Implemented Interfaces
javafx.animation.Interpolatable
Imports
java.util.ArrayList, .Arrays, .Collections, .List, .Objects, com.sun.javafx.UnmodifiableArrayList, com.sun.javafx.util.InterpolationUtils, javafx.animation.Interpolatable, javafx.beans.NamedArg

Defines one element of the ramp of colors to use on a gradient. For more information see javafx.scene.paint.LinearGradient and javafx.scene.paint.RadialGradient.

Example:

// object bounding box relative (proportional:true, default)
Stop[] stops = { new Stop(0, Color.WHITE), new Stop(1, Color.BLACK)};
LinearGradient lg = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);
Rectangle r = new Rectangle();
r.setFill(lg);
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private Color
color

The color of the gradient at this offset.

private int
hash

The cached hash code, used to improve performance in situations where we cache gradients, such as in the CSS routines.

pack-priv static final List<Stop>
private double
offset

The offset variable is a number ranging from 0 to 1 that indicates where this gradient stop is placed.

Constructor Summary

AccessConstructor and Description
public
Stop(double
Stop's position (ranging from 0 to 1
offset
,
Color
Stop's color
color
)

Creates a new instance of Stop.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this object is equal to the obj argument; false otherwise.
equals
(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public final Color

Returns:

the color of the gradient at this offset
getColor
()

Gets the color of the gradient at this offset.

public final double

Returns:

position of the Stop within the gradient (ranging from 0 to 1)
getOffset
()

Gets a number ranging from 0 to 1 that indicates where this gradient stop is placed.

public int

Returns:

a hash code for this Stop object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code for this Stop object.

public Stop
interpolate(Stop endValue, double t)

Implements javafx.animation.Interpolatable.interpolate.

Returns an intermediate value between the value of this Interpolatable and the specified endValue using the linear interpolation factor t.

pack-priv static List<Stop>

Returns:

the interpolated list, which may also be firstList or secondList; if a new list is returned, it is unmodifiable
interpolateLists
(List<Stop>
the first list, not null
firstList
,
List<Stop>
the second list, not null
secondList
,
double t)

Interpolates between two normalized lists of stops.

private static Stop
interpolateVirtualStop(Stop A2, Stop B2, Stop B1, double t)

Consider two lists A and B, where A contains three stops, and B contains two stops:

A2
            /   \
          /      \
   B1---/----[X]--\--B2
      /            \
    /               \
  A1                 A3
pack-priv static List<Stop>
normalize(Stop[] stops)

pack-priv static List<Stop>
public String

Returns:

a string representation of this Stop object.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this Stop object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

colorback to summary
private Color color

The color of the gradient at this offset.

Default Value
Color.BLACK
hashback to summary
private int hash

The cached hash code, used to improve performance in situations where we cache gradients, such as in the CSS routines.

NO_STOPSback to summary
pack-priv static final List<Stop> NO_STOPS
offsetback to summary
private double offset

The offset variable is a number ranging from 0 to 1 that indicates where this gradient stop is placed. For linear gradients, the offset variable represents a location along the gradient vector. For radial gradients, it represents a percentage distance from the focus point to the edge of the outermost/largest circle.

Default Value
0.0

Constructor Detail

Stopback to summary
public Stop(double offset, Color color)

Creates a new instance of Stop.

Parameters
offset:double

Stop's position (ranging from 0 to 1

color:Color

Stop's color

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is equal to the obj argument; false otherwise.

Annotations
@Override
getColorback to summary
public final Color getColor()

Gets the color of the gradient at this offset.

Returns:Color

the color of the gradient at this offset

getOffsetback to summary
public final double getOffset()

Gets a number ranging from 0 to 1 that indicates where this gradient stop is placed. For linear gradients, the offset variable represents a location along the gradient vector. For radial gradients, it represents a percentage distance from the focus point to the edge of the outermost/largest circle.

Returns:double

position of the Stop within the gradient (ranging from 0 to 1)

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code for this Stop object.

Returns:int

a hash code for this Stop object.

Annotations
@Override
interpolateback to summary
public Stop interpolate(Stop endValue, double t)

Implements javafx.animation.Interpolatable.interpolate.

Doc from javafx.animation.Interpolatable.interpolate.

Returns an intermediate value between the value of this Interpolatable and the specified endValue using the linear interpolation factor t. The interpolation factor can be any finite value.

The returned value might not be a new instance; the implementation might also return one of the two existing instances if the intermediate value would be equal to one of the existing values. However, this is an optimization and applications should not assume any particular identity of the returned value.

Annotations
@Override
Exceptions
NullPointerException:
if endValue is null
Since
24
interpolateListsback to summary
pack-priv static List<Stop> interpolateLists(List<Stop> firstList, List<Stop> secondList, double t)

Interpolates between two normalized lists of stops.

Parameters
firstList:List<Stop>

the first list, not null

secondList:List<Stop>

the second list, not null

Returns:List<Stop>

the interpolated list, which may also be firstList or secondList; if a new list is returned, it is unmodifiable

interpolateVirtualStopback to summary
private static Stop interpolateVirtualStop(Stop A2, Stop B2, Stop B1, double t)

Consider two lists A and B, where A contains three stops, and B contains two stops:

A2
            /   \
          /      \
   B1---/----[X]--\--B2
      /            \
    /               \
  A1                 A3
Given the stops A{1,2,3} and B{1,2} in the diagram above, this method computes a new virtual stop X that matches the offset of A2, and then interpolates between X and A2.
normalizeback to summary
pack-priv static List<Stop> normalize(Stop[] stops)
normalizeback to summary
pack-priv static List<Stop> normalize(List<Stop> stops)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this Stop object.

Returns:String

a string representation of this Stop object.

Annotations
@Override