Class LinearGradient

  • All Implemented Interfaces:
    Serializable, OptionDataListener, org.zkoss.json.JSONAware

    public class LinearGradient
    extends Optionable
    A linear gradient is a smooth transition from one color to another. In addition, several color transitions can be applied to the same element.

    All the options in this class support DynamicalAttribute.

    Author:
    jumperchen
    See Also:
    Serialized Form
    • Constructor Detail

      • LinearGradient

        public LinearGradient​(double x1,
                              double y1,
                              double x2,
                              double y2)
        The x1, x2, y1,y2 attributes of the linearGradient define the start and end position of the gradient
    • Method Detail

      • addStop

        public void addStop​(double index,
                            String color)
        Adds the color range for a gradient can be composed of two or more colors. Each color is specified with a offset in order.
      • setStops

        public void setStops​(String color1,
                             String color2)
        Sets the color range for a gradient can be composed of two colors. It is the same as
        
         setStops(new Stop(0, color1), new Stop(1, color2));
         
        See Also:
        setStops(Stop... stops)
      • setStops

        public void setStops​(List<Stop> stops)
        Sets the color range for a gradient can be composed of two or more colors. Each color is specified with a offset in order.

        For example,

        
         setStops(Arrays.asList(
             new Stop[]{
                 new Stop(0, "rgb(255, 255, 255)"),
                 new Stop(1, "rgb(200, 200, 255)")
             }
         ));
         
      • setStops

        public void setStops​(Stop... stops)
        Sets the color range for a gradient can be composed of two or more colors. Each color is specified with a offset in order.

        For example,

        
         setStops(new Stop(0, "rgb(255, 255, 255)"),
                  new Stop(1, "rgb(200, 200, 255)"));
         
      • getStops

        public List<Stop> getStops()
        Returns the all stops