org.apache.xmlgraphics.image.loader.impl

## Class ImageConverterG2D2Bitmap

- java.lang.Object
- - org.apache.xmlgraphics.image.loader.impl.AbstractImageConverter
  - - org.apache.xmlgraphics.image.loader.impl.ImageConverterG2D2Bitmap

- All Implemented Interfaces:
    ImageConverter

      public class ImageConverterG2D2Bitmap
      extends AbstractImageConverter

  This ImageConverter converts Graphics2D images to a BufferedImage.

- - ### 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
    `ImageConverterG2D2Bitmap()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Image` | `convert(Image src, java.util.Map<java.lang.String,java.lang.Object> hints)` Converts an image into a different representation.
    `ImageFlavor` | `getSourceFlavor()` Returns the flavor that this converter expects.
    `ImageFlavor` | `getTargetFlavor()` Returns the flavor that this converter converts images into.
    `protected java.awt.image.BufferedImage` | `paintToBufferedImage(ImageGraphics2D g2dImage, int bitsPerPixel, boolean withAlpha, int resolution, boolean cmyk)` Paints a Graphics2D image on a BufferedImage and returns this bitmap.
    `protected void` | `setRenderingHintsForBufferedImage(java.awt.Graphics2D g2d)` Sets rendering hints on the Graphics2D created for painting to a BufferedImage.

    - ### 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

    - #### ImageConverterG2D2Bitmap

          public ImageConverterG2D2Bitmap()

  - ### Method Detail

    - #### convert

          public Image convert(Image src,
                               java.util.Map<java.lang.String,java.lang.Object> hints)

      Converts an image into a different representation.

      Consumers can get the effective MIME type (if any) from the associated `ImageFlavor`.

      Parameters:
        `src` - the source image
        `hints` - the conversion hints
      Returns:
        the converted image

    - #### paintToBufferedImage

          protected java.awt.image.BufferedImage paintToBufferedImage(ImageGraphics2D g2dImage,
                                                                      int bitsPerPixel,
                                                                      boolean withAlpha,
                                                                      int resolution,
                                                                      boolean cmyk)

      Paints a Graphics2D image on a BufferedImage and returns this bitmap.
      Parameters:
        `g2dImage` - the Graphics2D image
        `bitsPerPixel` - the desired number of bits per pixel (supported: 1, 8, 24)
        `withAlpha` - true if the generated image should have an alpha channel
        `resolution` - the requested bitmap resolution
      Returns:
        the newly created BufferedImage

    - #### setRenderingHintsForBufferedImage

          protected void setRenderingHintsForBufferedImage(java.awt.Graphics2D g2d)

      Sets rendering hints on the Graphics2D created for painting to a BufferedImage. Subclasses can modify the settings to customize the behaviour.
      Parameters:
        `g2d` - the Graphics2D instance

    - #### getSourceFlavor

          public ImageFlavor getSourceFlavor()

      Returns the flavor that this converter expects.
      Returns:
        the source flavor

    - #### getTargetFlavor

          public ImageFlavor getTargetFlavor()

      Returns the flavor that this converter converts images into.
      Returns:
        the target flavor

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