org.apache.poi.hwmf.draw

## Class HwmfImageRenderer

- java.lang.Object
- - org.apache.poi.hwmf.draw.HwmfImageRenderer

- All Implemented Interfaces:
    EmbeddedExtractor, ImageRenderer

      public class HwmfImageRenderer
      extends java.lang.Object
      implements ImageRenderer, EmbeddedExtractor

  Helper class which is instantiated by `DrawPictureShape` via reflection

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.poi.sl.draw.EmbeddedExtractor

      `EmbeddedExtractor.EmbeddedPart`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HwmfImageRenderer()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canRender(java.lang.String contentType)` Determines if this image renderer implementation supports the given contentType
    `boolean` | `drawImage(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D anchor)` Render picture data into the supplied graphics
    `boolean` | `drawImage(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D anchor, java.awt.Insets clip)` Render picture data into the supplied graphics
    `java.awt.geom.Rectangle2D` | `getBounds()`
    `java.awt.geom.Dimension2D` | `getDimension()`
    `java.lang.Iterable<EmbeddedExtractor.EmbeddedPart>` | `getEmbeddings()`
    `static java.lang.Iterable<EmbeddedExtractor.EmbeddedPart>` | `getEmbeddings(java.lang.Iterable<HwmfEmbedded> embs)`
    `GenericRecord` | `getGenericRecord()`
    `java.awt.image.BufferedImage` | `getImage()`
    `java.awt.image.BufferedImage` | `getImage(java.awt.geom.Dimension2D dim)`
    `java.awt.geom.Rectangle2D` | `getNativeBounds()`
    `static java.awt.geom.Rectangle2D` | `getOuterBounds(java.awt.geom.Rectangle2D anchor, java.awt.Insets clip)`
    `void` | `loadImage(byte[] data, java.lang.String contentType)` Load and buffer the image
    `void` | `loadImage(java.io.InputStream data, java.lang.String contentType)` Load and buffer the image
    `void` | `setAlpha(double alpha)`

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

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

- - ### Constructor Detail

    - #### HwmfImageRenderer

          public HwmfImageRenderer()

  - ### Method Detail

    - #### canRender

          public boolean canRender(java.lang.String contentType)

      Description copied from interface: `ImageRenderer`
      Determines if this image renderer implementation supports the given contentType
      Specified by:
        `canRender` in interface `ImageRenderer`
      Parameters:
        `contentType` - the image content type
      Returns:
        if the content type is supported

    - #### loadImage

          public void loadImage(java.io.InputStream data,
                                java.lang.String contentType)
                         throws java.io.IOException

      Description copied from interface: `ImageRenderer`
      Load and buffer the image
      Specified by:
        `loadImage` in interface `ImageRenderer`
      Parameters:
        `data` - the raw image stream
        `contentType` - the content type
      Throws:
        `java.io.IOException`

    - #### loadImage

          public void loadImage(byte[] data,
                                java.lang.String contentType)
                         throws java.io.IOException

      Description copied from interface: `ImageRenderer`
      Load and buffer the image
      Specified by:
        `loadImage` in interface `ImageRenderer`
      Parameters:
        `data` - the raw image bytes
        `contentType` - the content type
      Throws:
        `java.io.IOException`

    - #### getDimension

          public java.awt.geom.Dimension2D getDimension()

      Specified by:
        `getDimension` in interface `ImageRenderer`
      Returns:
        the dimension of the buffered image in pixel

    - #### setAlpha

          public void setAlpha(double alpha)

      Specified by:
        `setAlpha` in interface `ImageRenderer`
      Parameters:
        `alpha` - the alpha [0..1] to be added to the image (possibly already containing an alpha channel)

    - #### getImage

          public java.awt.image.BufferedImage getImage()

      Specified by:
        `getImage` in interface `ImageRenderer`
      Returns:
        the image as buffered image or null if image could not be loaded

    - #### getImage

          public java.awt.image.BufferedImage getImage(java.awt.geom.Dimension2D dim)

      Specified by:
        `getImage` in interface `ImageRenderer`
      Parameters:
        `dim` - the dimension in pixels of the returned image
      Returns:
        the image as buffered image or null if image could not be loaded

    - #### drawImage

          public boolean drawImage(java.awt.Graphics2D graphics,
                                   java.awt.geom.Rectangle2D anchor)

      Description copied from interface: `ImageRenderer`
      Render picture data into the supplied graphics
      Specified by:
        `drawImage` in interface `ImageRenderer`
      Returns:
        true if the picture data was successfully rendered

    - #### drawImage

          public boolean drawImage(java.awt.Graphics2D graphics,
                                   java.awt.geom.Rectangle2D anchor,
                                   java.awt.Insets clip)

      Description copied from interface: `ImageRenderer`
      Render picture data into the supplied graphics
      Specified by:
        `drawImage` in interface `ImageRenderer`
      Returns:
        true if the picture data was successfully rendered

    - #### getOuterBounds

          @Internal
          public static java.awt.geom.Rectangle2D getOuterBounds(java.awt.geom.Rectangle2D anchor,
                                                                           java.awt.Insets clip)

    - #### getGenericRecord

          public GenericRecord getGenericRecord()

      Specified by:
        `getGenericRecord` in interface `ImageRenderer`

    - #### getEmbeddings

          public java.lang.Iterable<EmbeddedExtractor.EmbeddedPart> getEmbeddings()

      Specified by:
        `getEmbeddings` in interface `EmbeddedExtractor`

    - #### getEmbeddings

          @Internal
          public static java.lang.Iterable<EmbeddedExtractor.EmbeddedPart> getEmbeddings(java.lang.Iterable<HwmfEmbedded> embs)

    - #### getNativeBounds

          public java.awt.geom.Rectangle2D getNativeBounds()

      Specified by:
        `getNativeBounds` in interface `ImageRenderer`
      Returns:
        the format-specific / not-normalized bounds of the image

    - #### getBounds

          public java.awt.geom.Rectangle2D getBounds()

      Specified by:
        `getBounds` in interface `ImageRenderer`
      Returns:
        the bounds of the buffered image in pixel

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.