Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: LinearGradient

[15:7] extends: FxObj

Wraps JavaFX LinearGradient, a paint that transitions colors along a straight line defined by two points and a series of color stops. The gradient can use proportional (0.0 to 1.0) or absolute pixel coordinates, and a cycle method controls what happens beyond the defined endpoints. It can be used with GraphicsContext setFill() and setStroke() in place of a solid Color.

Methods

  • LinearGradient (double StartX, double StartY, double EndX, double EndY, bool Proportional, string CycleMethod, list Stops)

    Creates a new linear gradient.

    • @p StartX is a double with the start X coordinate.
    • @p StartY is a double with the start Y coordinate.
    • @p EndX is a double with the end X coordinate.
    • @p EndY is a double with the end Y coordinate.
    • @p Proportional is a bool. When true, coordinates are proportional (0.0 to 1.0). When false, they are absolute.
    • @p CycleMethod is a string with the cycle method: NO_CYCLE, REFLECT, or REPEAT.
    • @p Stops is a list of Stop objects defining the gradient colors.
  • getStartX ()

    Returns the X coordinate of the gradient start point.

    • @r A double with the start X.
  • getStartY ()

    Returns the Y coordinate of the gradient start point.

    • @r A double with the start Y.
  • getEndX ()

    Returns the X coordinate of the gradient end point.

    • @r A double with the end X.
  • getEndY ()

    Returns the Y coordinate of the gradient end point.

    • @r A double with the end Y.
  • isProportional ()

    Returns whether the gradient coordinates are proportional (0.0 to 1.0) rather than absolute pixel values.

    • @r A bool with true when proportional.
  • getCycleMethod ()

    Returns the cycle method enum value used when the gradient is sampled outside the defined start/end points.

    • @r An AJO holding the javafx.scene.paint.CycleMethod enum value.
  • getStops ()

    Returns the list of color Stop entries that define the gradient.

    • @r A List AJO of Stop elements.
  • isOpaque ()

    Returns whether the gradient is fully opaque (every stop color has an alpha of 1.0).

    • @r A bool with true when the gradient is opaque.