org.apache.fop.image.loader.batik

## Class ImageConverterSVG2G2D

- java.lang.Object
- - org.apache.xmlgraphics.image.loader.impl.AbstractImageConverter
  - - org.apache.fop.image.loader.batik.ImageConverterSVG2G2D

- All Implemented Interfaces:
    org.apache.xmlgraphics.image.loader.spi.ImageConverter

      public class ImageConverterSVG2G2D
      extends org.apache.xmlgraphics.image.loader.impl.AbstractImageConverter

  This ImageConverter converts SVG images to Java2D.

  Note: The target flavor is "generic" Java2D. No Batik-specific bridges are hooked into the conversion process. Specialized renderers may want to provide specialized adapters to profit from target-format features (for example with PDF or PS). This converter is mainly for formats which only support bitmap images or rudimentary Java2D support.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.xmlgraphics.image.loader.spi.ImageConverter

      `MEDIUM_CONVERSION_PENALTY, MINIMAL_CONVERSION_PENALTY, NO_CONVERSION_PENALTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImageConverterSVG2G2D()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.xmlgraphics.image.loader.Image` | `convert(org.apache.xmlgraphics.image.loader.Image src, java.util.Map hints)`
    `protected SimpleSVGUserAgent` | `createBatikUserAgent(float pxToMillimeter)` Creates a user agent for Batik.
    `protected org.apache.xmlgraphics.java2d.Graphics2DImagePainter` | `createPainter(org.apache.batik.bridge.BridgeContext ctx, org.apache.batik.gvt.GraphicsNode root, java.awt.Dimension imageSize)` Creates a Graphics 2D image painter
    `org.apache.xmlgraphics.image.loader.ImageFlavor` | `getSourceFlavor()`
    `org.apache.xmlgraphics.image.loader.ImageFlavor` | `getTargetFlavor()`

    - ### Methods inherited from class org.apache.xmlgraphics.image.loader.impl.AbstractImageConverter

      `checkSourceFlavor, getConversionPenalty`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ImageConverterSVG2G2D

          public ImageConverterSVG2G2D()

  - ### Method Detail

    - #### convert

          public org.apache.xmlgraphics.image.loader.Image convert(org.apache.xmlgraphics.image.loader.Image src,
                                                          java.util.Map hints)
                                                            throws org.apache.xmlgraphics.image.loader.ImageException

      Throws:
        `org.apache.xmlgraphics.image.loader.ImageException`

    - #### createBatikUserAgent

          protected SimpleSVGUserAgent createBatikUserAgent(float pxToMillimeter)

      Creates a user agent for Batik. Override to provide your own user agent.
      Parameters:
        `pxToMillimeter` - the source resolution (in px per millimeter)
      Returns:
        the newly created user agent

    - #### createPainter

          protected org.apache.xmlgraphics.java2d.Graphics2DImagePainter createPainter(org.apache.batik.bridge.BridgeContext ctx,
                                                                           org.apache.batik.gvt.GraphicsNode root,
                                                                           java.awt.Dimension imageSize)

      Creates a Graphics 2D image painter
      Parameters:
        `ctx` - the bridge context
        `root` - the graphics node root
        `imageSize` - the image size
      Returns:
        the newly created graphics 2d image painter

    - #### getSourceFlavor

          public org.apache.xmlgraphics.image.loader.ImageFlavor getSourceFlavor()

    - #### getTargetFlavor

          public org.apache.xmlgraphics.image.loader.ImageFlavor getTargetFlavor()

Copyright 1999-2019 The Apache Software Foundation. All Rights Reserved.