Class SVGAlphaComposite

java.lang.Object
org.apache.batik.svggen.AbstractSVGConverter
org.apache.batik.svggen.SVGAlphaComposite
All Implemented Interfaces:
XMLConstants, ErrorConstants, SVGConverter, SVGSyntax, CSSConstants, SVGConstants

public class SVGAlphaComposite extends AbstractSVGConverter
Utility class that converts an AlphaComposite object into a set of SVG properties and definitions. Here is how AlphaComposites are mapped to SVG: + AlphaComposite.SRC_OVER with extra alpha is mapped to the opacity attribute + AlphaComposite's other rules are translated into predefined filter effects. One of the big differences between AlphaComposite and the SVG feComposite filter is that feComposite does not have the notion of extra alpha applied to the source. The extra alpha equivalent is obtained by setting the opacity property on the nodes to be composited.
Version:
$Id: SVGAlphaComposite.java 1808888 2017-09-19 14:22:11Z ssteiner $
See Also:
  • Field Details

    • compositeDefsMap

      private Map compositeDefsMap
      Map of all possible AlphaComposite filter equivalents
    • backgroundAccessRequired

      private boolean backgroundAccessRequired
      By default, access to the background is not required.
  • Constructor Details

    • SVGAlphaComposite

      public SVGAlphaComposite(SVGGeneratorContext generatorContext)
      Parameters:
      generatorContext - for use by SVGAlphaComposite to build Elements
  • Method Details

    • getAlphaCompositeFilterSet

      public List getAlphaCompositeFilterSet()
      Returns:
      set of all AlphaComposite filter definitions
    • requiresBackgroundAccess

      public boolean requiresBackgroundAccess()
      Returns:
      true if background access is required for any of the converted AlphaComposite rules
    • toSVG

      public SVGDescriptor toSVG(GraphicContext gc)
      Converts part or all of the input GraphicContext into a set of attribute/value pairs and related definitions
      Parameters:
      gc - GraphicContext to be converted
      Returns:
      descriptor of the attributes required to represent some or all of the GraphicContext state, along with the related definitions
      See Also:
    • toSVG

      public SVGCompositeDescriptor toSVG(AlphaComposite composite)
      Parameters:
      composite - the AlphaComposite object to convert to SVG
      Returns:
      an SVGCompositeDescriptor that defines how to map the input composite in SVG
    • compositeToSVG

      private Element compositeToSVG(AlphaComposite composite)
      Parameters:
      composite - AlphaComposite to convert to a filter effect
      Throws:
      Error - if an AlphaComposite with SRC_OVER rule in passed to this method.