Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.fop.render
Class AbstractGraphics2DAdapter

    java.lang.Object
      org.apache.fop.render.AbstractGraphics2DAdapter

All Implemented Interfaces:
  Graphics2DAdapter

Direct Known Subclasses:
  AFPGraphics2DAdapter, Java2DGraphics2DAdapter, PCLGraphics2DAdapter, PDFGraphics2DAdapter, PSGraphics2DAdapter

public abstract class AbstractGraphics2DAdapter
extends java.lang.Object
implements Graphics2DAdapter

Abstract base class for Graphics2DAdapter implementations.

Constructor Summary
`AbstractGraphics2DAdapter()`

Method Summary
`protected int` | `mpt2px(int unit, int resolution)` Converts millipoints to pixels
`void` | `paintImage(Graphics2DImagePainter painter, RendererContext context, int x, int y, int width, int height)` Paints an arbitrary images on a given Graphics2D instance. The renderer providing this functionality must set up a Graphics2D instance so that the image with the given extents (in mpt) can be painted by the painter passed to this method. The Graphics2DImagePainter is then passed this Graphics2D instance so the image can be painted.
`protected java.awt.image.BufferedImage` | `paintToBufferedImage(org.apache.xmlgraphics.java2d.Graphics2DImagePainter painter, RendererContext.RendererContextWrapper context, int resolution, boolean gray, boolean withAlpha)` Paints the image to a BufferedImage and returns that.
`protected void` | `setRenderingHintsForBufferedImage(java.awt.Graphics2D g2d)` Sets rendering hints on the Graphics2D created for painting to a BufferedImage.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.fop.render.Graphics2DAdapter
`paintImage`

Constructor Detail

### AbstractGraphics2DAdapter

    public AbstractGraphics2DAdapter()

Method Detail

### paintToBufferedImage

    protected java.awt.image.BufferedImage paintToBufferedImage(org.apache.xmlgraphics.java2d.Graphics2DImagePainter painter,
                                                                RendererContext.RendererContextWrapper context,
                                                                int resolution,
                                                                boolean gray,
                                                                boolean withAlpha)

  Paints the image to a BufferedImage and returns that.

  Parameters:
    `painter` - the painter which will paint the actual image
    `context` - the renderer context for the current renderer
    `resolution` - the requested bitmap resolution
    `gray` - true if the generated image should be in grayscales
    `withAlpha` - true if an alpha channel should be created
  Returns:
    the generated BufferedImage

### mpt2px

    protected int mpt2px(int unit,
                         int resolution)

  Converts millipoints to pixels

  Parameters:
    `unit` - the unit to convert in mpts
    `resolution` - the target resolution
  Returns:
    the converted unit in pixels

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

### paintImage

    public void paintImage(Graphics2DImagePainter painter,
                           RendererContext context,
                           int x,
                           int y,
                           int width,
                           int height)
                    throws java.io.IOException

  Paints an arbitrary images on a given Graphics2D instance. The renderer providing this functionality must set up a Graphics2D instance so that the image with the given extents (in mpt) can be painted by the painter passed to this method. The Graphics2DImagePainter is then passed this Graphics2D instance so the image can be painted.

  Specified by:
    `paintImage` in interface `Graphics2DAdapter`
  Parameters:
    `painter` - the painter which will paint the actual image
    `context` - the renderer context for the current renderer
    `x` - X position of the image
    `y` - Y position of the image
    `width` - width of the image
    `height` - height of the image
  Throws:
    `java.io.IOException` - In case of an I/O error while writing the output format

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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