Package ej.microvg

Class LinearGradient


  • public class LinearGradient
    extends Object
    Represents a linear gradient on a vector.
    • Constructor Detail

      • LinearGradient

        public LinearGradient​(float xStart,
                              float yStart,
                              float xEnd,
                              float yEnd,
                              int[] colors,
                              float[] positions)
        Creates a linear gradient.
        Parameters:
        xStart - the x-coordinate for the start of the gradient vector
        yStart - the y-coordinate for the start of the gradient vector
        xEnd - the x-coordinate for the end of the gradient vector
        yEnd - the y-coordinate for the end of the gradient vector
        colors - the sRGB colors to be distributed along the gradient vector
        positions - the relative positions [0..1] of each corresponding color in the colors array
      • LinearGradient

        public LinearGradient​(float xStart,
                              float yStart,
                              float xEnd,
                              float yEnd,
                              int[] colors)
        Creates a linear gradient.

        The colors are distributed evenly along the gradient vector.

        Parameters:
        xStart - the x-coordinate for the start of the gradient vector
        yStart - the y-coordinate for the start of the gradient vector
        xEnd - the x-coordinate for the end of the gradient vector
        yEnd - the y-coordinate for the end of the gradient vector
        colors - the sRGB colors to be distributed along the gradient vector
    • Method Detail

      • getMatrix

        public Matrix getMatrix()
        Gets the matrix of this linear gradient.

        Any modification on the matrix will affect the gradient.

        Returns:
        the matrix