Packages

 

com.aspose.imaging.brushes

Class LinearGradientBrush

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public final class LinearGradientBrush
    extends LinearGradientBrushBase

    Encapsulates a Aspose.Imaging.Brush with a linear gradient. This class cannot be inherited.

    • Constructor Detail

      • LinearGradientBrush

        public LinearGradientBrush()

        Initializes a new instance of the LinearGradientBrush class with default parameters. The starting color is black, the ending color is white, the angle is 45 degrees and the rectangle is located in (0,0) with size (1,1).

      • LinearGradientBrush

        public LinearGradientBrush(Point point1,
                                   Point point2,
                                   Color color1,
                                   Color color2)

        Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

        Parameters:
        point1 - A Aspose.Imaging.Point structure that represents the starting point of the linear gradient.
        point2 - A Aspose.Imaging.Point structure that represents the endpoint of the linear gradient.
        color1 - A com.aspose.imaging.Color structure that represents the starting color of the linear gradient.
        color2 - A com.aspose.imaging.Color structure that represents the ending color of the linear gradient.
      • LinearGradientBrush

        public LinearGradientBrush(PointF point1,
                                   PointF point2,
                                   Color color1,
                                   Color color2)

        Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

        Parameters:
        point1 - A Aspose.Imaging.PointF structure that represents the starting point of the linear gradient.
        point2 - A Aspose.Imaging.PointF structure that represents the endpoint of the linear gradient.
        color1 - A com.aspose.imaging.Color structure that represents the starting color of the linear gradient.
        color2 - A com.aspose.imaging.Color structure that represents the ending color of the linear gradient.
      • LinearGradientBrush

        public LinearGradientBrush(Rectangle rect,
                                   Color color1,
                                   Color color2,
                                   float angle)

        Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

        Parameters:
        rect - A Aspose.Imaging.RectangleF structure that specifies the bounds of the linear gradient.
        color1 - A com.aspose.imaging.Color structure that represents the starting color for the gradient.
        color2 - A com.aspose.imaging.Color structure that represents the ending color for the gradient.
        angle - The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.
      • LinearGradientBrush

        public LinearGradientBrush(RectangleF rect,
                                   Color color1,
                                   Color color2,
                                   float angle)

        Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

        Parameters:
        rect - A Aspose.Imaging.RectangleF structure that specifies the bounds of the linear gradient.
        color1 - A com.aspose.imaging.Color structure that represents the starting color for the gradient.
        color2 - A com.aspose.imaging.Color structure that represents the ending color for the gradient.
        angle - The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.
      • LinearGradientBrush

        public LinearGradientBrush(Rectangle rect,
                                   Color color1,
                                   Color color2,
                                   float angle,
                                   boolean isAngleScalable)

        Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

        Parameters:
        rect - A Aspose.Imaging.RectangleF structure that specifies the bounds of the linear gradient.
        color1 - A com.aspose.imaging.Color structure that represents the starting color for the gradient.
        color2 - A com.aspose.imaging.Color structure that represents the ending color for the gradient.
        angle - The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.
        isAngleScalable - if set to true the angle is changed during transformations with this LinearGradientBrush.
      • LinearGradientBrush

        public LinearGradientBrush(RectangleF rect,
                                   Color color1,
                                   Color color2,
                                   float angle,
                                   boolean isAngleScalable)

        Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

        Parameters:
        rect - A Aspose.Imaging.RectangleF structure that specifies the bounds of the linear gradient.
        color1 - A com.aspose.imaging.Color structure that represents the starting color for the gradient.
        color2 - A com.aspose.imaging.Color structure that represents the ending color for the gradient.
        angle - The angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.
        isAngleScalable - if set to true the angle is changed during transformations with this LinearGradientBrush.
    • Method Detail

      • getInterpolationColors

        @Deprecated
        public ColorBlend getInterpolationColors()
        Deprecated. 

        Gets a com.aspose.imaging.ColorBlend that defines a multicolor linear gradient.

        Returns:
        A com.aspose.imaging.ColorBlend that defines a multicolor linear gradient.
      • setInterpolationColors

        @Deprecated
        public void setInterpolationColors(ColorBlend value)
        Deprecated. 

        Sets a com.aspose.imaging.ColorBlend that defines a multicolor linear gradient.

        Parameters:
        value - A com.aspose.imaging.ColorBlend that defines a multicolor linear gradient.
      • getLinearColors

        @Deprecated
        public Color[] getLinearColors()
        Deprecated. 

        Gets the starting and ending colors of the gradient.

        Returns:
        An array of two Color structures that represents the starting and ending colors of the gradient.
      • setLinearColors

        @Deprecated
        public void setLinearColors(Color[] value)
        Deprecated. 

        Sets the starting and ending colors of the gradient.

        Parameters:
        value - An array of two Color structures that represents the starting and ending colors of the gradient.
      • getStartColor

        public Color getStartColor()

        Gets the starting gradient color.

        Returns:
        The starting gradient color.
      • setStartColor

        public void setStartColor(Color value)

        Sets the starting gradient color.

        Parameters:
        value - The starting gradient color.
      • getEndColor

        public Color getEndColor()

        Gets the ending gradient color.

        Returns:
        The ending gradient color.
      • setEndColor

        public void setEndColor(Color value)

        Sets the ending gradient color.

        Parameters:
        value - The ending gradient color.
      • getBlend

        public Blend getBlend()

        Gets a Aspose.Imaging.Blend that specifies positions and factors that define a custom falloff for the gradient.

        Returns:
        A Aspose.Imaging.Blend that represents a custom falloff for the gradient.
      • setBlend

        public void setBlend(Blend value)

        Sets a Aspose.Imaging.Blend that specifies positions and factors that define a custom falloff for the gradient.

        Parameters:
        value - A Aspose.Imaging.Blend that represents a custom falloff for the gradient.
      • setSigmaBellShape

        public void setSigmaBellShape(float focus)

        Creates a gradient falloff based on a bell-shaped curve.

        Parameters:
        focus - A value from 0 through 1 that specifies the center of the gradient (the point where the starting color and ending color are blended equally).
      • setSigmaBellShape

        public void setSigmaBellShape(float focus,
                                      float scale)

        Creates a gradient falloff based on a bell-shaped curve.

        Parameters:
        focus - A value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
        scale - A value from 0 through 1 that specifies how fast the colors falloff from the focus.
      • setBlendTriangularShape

        public void setBlendTriangularShape(float focus)

        Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

        Parameters:
        focus - A value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
      • setBlendTriangularShape

        public void setBlendTriangularShape(float focus,
                                            float scale)

        Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

        Parameters:
        focus - A value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
        scale - A value from 0 through1 that specifies how fast the colors falloff from the starting color to focus (ending color)