Class GradientFactory


  • public class GradientFactory
    extends Object
    • Constructor Detail

      • GradientFactory

        public GradientFactory()
        Creates a new GradientFactory. The gradient transformation policy of the GradientFactory is set to GradientPolicy.USE_SUPPORTED.
    • Method Detail

      • setTransformationPolicy

        public void setTransformationPolicy​(GradientPolicy policy)
        Sets the gradient transformation policy of the factory. Valid values are:
        • GradientPolicy.USE_SUPPORTED - The coordinates for the gradient are transformed using only supported transformation elements (translation and rotation). This will lead to non-accurate rendering if the matrix contains skew and/or scaling.
        • GradientPolicy.USE_AS_IS - The coordinates for the gradient are transformed using the complete transformation matrix. This will lead to non-accurate rendering if the matrix contains skew and/or scaling.
        • GradientPolicy.DISCARD - The coordinates are not transformed at all. This will lead to non-accurate rendering if the matrix is not the identity matrix.
        Parameters:
        policy - The policy to use when gradient transformations are performed.
      • createLinearGradient

        public javafx.scene.paint.LinearGradient createLinearGradient​(org.apache.batik.anim.dom.SVGOMLinearGradientElement element,
                                                                      List<javafx.scene.paint.Stop> stops)
        Creates a JavaFX LinearGradient from an SVG linearGradient element. Since JavaFX does not yet support gradient transformations, some fuzziness is applied when the SVG gradient definition contains a gradient transformation matrix. The fuzziness can be controlled through the GradientFactory's gradientTransformPolicy. See setTransformationPolicy(GradientPolicy) for more information.
        Parameters:
        element - The SVG gradient element.
        stops - The stops which have already been extracted from the SVG gradient child nodes.
        Returns:
        A JavaFX LinearGradient based on the SVG linear gradient element.
      • createRadialGradient

        public javafx.scene.paint.RadialGradient createRadialGradient​(org.apache.batik.anim.dom.SVGOMRadialGradientElement element,
                                                                      List<javafx.scene.paint.Stop> stops)
        Creates a JavaFX RadialGradient from an SVG radialGradient element. Currently the SVG gradient transformation is ignored by this method. A warning is logged if the SVG gradient element contains a gradientTransform attribute.
        Parameters:
        element - The SVG gradient element.
        stops - The stops which have already been extracted from the SVG gradient child nodes.
        Returns:
        A JavaFX RadialGradient based on the SVG linear gradient element.