Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-448

Incomplete support for AlphaComposite causes SVG encoding failure

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.5
    • Fix Version/s: None
    • Component/s: SVGGraphics2D
    • Labels:
      None
    • Environment:
      Operating System: other
      Platform: All

      Description

      Summary:
      Certain AlphaComposites will cause SVGGraphics2D to fail.

      Code:
      SVGGraphics2D g = ...;
      g.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_ATOP));

      Description:

      Batik uses org.apache.batik.svggen.SVGAlphaComposite to represent
      AlphaComposite in SVG output. SVGAlphaComposite supports only a subset of
      possible AlphaComposites, namely SRC, SRC_IN, SRC_OUT, DST_IN, DST_OUT,
      DST_OVER, CLEAR.
      It does not support SRC_ATOP, DST_ATOP, XOR.

      If any of the unused AlphaComposites are used, then exception is thrown as
      shown below.

      It appears that the composites in question were simply forgotten when a map of
      AlphaComposite filter definitions is initialized (compositeDefsMap). It should
      be fairly easy to fix this.

      Exception thrown:
      java.lang.NullPointerException
      at org.apache.batik.svggen.SVGAlphaComposite.toSVG(Unknown Source)
      at org.apache.batik.svggen.SVGComposite.toSVG(Unknown Source)
      at org.apache.batik.svggen.SVGComposite.toSVG(Unknown Source)
      at org.apache.batik.svggen.SVGGraphicContextConverter.toSVG(Unknown
      Source)
      at org.apache.batik.svggen.DOMGroupManager.addElement(Unknown Source)
      at org.apache.batik.svggen.SVGGraphics2D.fill(Unknown Source)

        Attachments

          Activity

            People

            • Assignee:
              batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
              Reporter:
              toly@intellidos.com Anatoli Krassavine
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: