com.tensegrity.gui.swing.graph
Class VisualGraphImageUtil

java.lang.Object
  extended bycom.tensegrity.gui.swing.graph.VisualGraphImageUtil

public class VisualGraphImageUtil
extends java.lang.Object

Class for rendering a VisualGraphView to an Image.

Author:
BurkhardWick

Method Summary
static java.awt.image.BufferedImage exportToImage(VisualGraphView visualgraphview, int width, int height, Renderer gfxRenderer, java.awt.Insets ins, java.awt.Color bgColor)
          Exports the given VisualGraphView to an image.
static Size getPreferredSize(VisualGraphView visualgraphview)
          Returns the preferred size for an unscaled export of the current VisualGraphView.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, java.awt.Insets insets)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, java.awt.Insets insets)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, java.awt.Insets insets, boolean preserveRatio)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, Renderer gfxRenderer, java.awt.Insets insets)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, Renderer gfxRenderer, java.awt.Insets insets, boolean preserveRatio)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, Renderer gfxRenderer, java.awt.Insets insets, boolean preserveRatio, boolean forceSize, boolean centerImage)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, Renderer gfxRenderer, java.awt.Insets insets, boolean preserveRatio, boolean forceSize, boolean centerImage, Transform2D transform)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, Renderer gfxRenderer, java.awt.Insets insets, boolean preserveRatio, boolean forceSize, boolean centerImage, Transform2D transform, java.awt.Color bgColor)
          Create an image of the panel's contents with the given size.
static java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview, int width, int height, Renderer gfxRenderer, java.awt.Insets insets, boolean preserveRatio, boolean forceSize, boolean centerImage, Transform2D transform, java.awt.Color bgColor, boolean antiAlias)
          Create an image of the panel's contents with the given size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPreferredSize

public static final Size getPreferredSize(VisualGraphView visualgraphview)
Returns the preferred size for an unscaled export of the current VisualGraphView.

Parameters:
visualgraphview - The VisualGraphView to retrieve the preferred size for
Returns:
the dimensions for unscaled export.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               java.awt.Insets insets)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               java.awt.Insets insets)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               Renderer gfxRenderer,
                                                               java.awt.Insets insets)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
gfxRenderer - The renderer used to render the image data
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               Renderer gfxRenderer,
                                                               java.awt.Insets insets,
                                                               boolean preserveRatio)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
gfxRenderer - The renderer used to render the image data
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
preserveRatio - if this parameter is set to true then the ratio of the width and the height of the graph is preserved in the resulting image.
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               java.awt.Insets insets,
                                                               boolean preserveRatio)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
preserveRatio - if this parameter is set to true then the ratio of the width and the height of the graph is preserved in the resulting image.
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               Renderer gfxRenderer,
                                                               java.awt.Insets insets,
                                                               boolean preserveRatio,
                                                               boolean forceSize,
                                                               boolean centerImage)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
gfxRenderer - The renderer used to render the image data
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
preserveRatio - if this parameter is set to true then the ratio of the width and the height of the graph is preserved in the resulting image.
forceSize - If this parameter is set the result image will always have the given width and height, even if the preserve ratio leads to empty space in the image
centerImage - If the option forceSize is turned on, there might be an empty space on the right or bottom side of the graph. With this option the graph will be centered.
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               Renderer gfxRenderer,
                                                               java.awt.Insets insets,
                                                               boolean preserveRatio,
                                                               boolean forceSize,
                                                               boolean centerImage,
                                                               Transform2D transform)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
gfxRenderer - The renderer used to render the image data
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
preserveRatio - if this parameter is set to true then the ratio of the width and the height of the graph is preserved in the resulting image.
forceSize - If this parameter is set the result image will always have the given width and height, even if the preserve ratio leads to empty space in the image
centerImage - If the option forceSize is turned on, there might be an empty space on the right or bottom side of the graph. With this option the graph will be centered.
transform - You can pass a Transform2D which will contain the transformation to convert shape bounds from logical units to the bounds in the rendered image afterwards.
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               Renderer gfxRenderer,
                                                               java.awt.Insets insets,
                                                               boolean preserveRatio,
                                                               boolean forceSize,
                                                               boolean centerImage,
                                                               Transform2D transform,
                                                               java.awt.Color bgColor)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
gfxRenderer - The renderer used to render the image data
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
preserveRatio - if this parameter is set to true then the ratio of the width and the height of the graph is preserved in the resulting image.
forceSize - If this parameter is set the result image will always have the given width and height, even if the preserve ratio leads to empty space in the image
centerImage - If the option forceSize is turned on, there might be an empty space on the right or bottom side of the graph. With this option the graph will be centered.
transform - You can pass a Transform2D which will contain the transformation to convert shape bounds from logical units to the bounds in the rendered image afterwards.
bgColor - the background color to use for the transparent regions of the view paint format
Returns:
the created image.

renderToImage

public static final java.awt.image.BufferedImage renderToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               Renderer gfxRenderer,
                                                               java.awt.Insets insets,
                                                               boolean preserveRatio,
                                                               boolean forceSize,
                                                               boolean centerImage,
                                                               Transform2D transform,
                                                               java.awt.Color bgColor,
                                                               boolean antiAlias)
Create an image of the panel's contents with the given size.

Parameters:
visualgraphview - The VisualGraph to render
width - width of the image to create.
height - height of the image to create.
gfxRenderer - The renderer used to render the image data
insets - The insets are used to create an empty border around the rendered image that can be used for drawing additional information. The insets are added to the given width and height and will enlarge the image. This parameter can be null.
preserveRatio - if this parameter is set to true then the ratio of the width and the height of the graph is preserved in the resulting image.
forceSize - If this parameter is set the result image will always have the given width and height, even if the preserve ratio leads to empty space in the image
centerImage - If the option forceSize is turned on, there might be an empty space on the right or bottom side of the graph. With this option the graph will be centered.
transform - You can pass a Transform2D which will contain the transformation to convert shape bounds from logical units to the bounds in the rendered image afterwards.
bgColor - the background color to use for the transparent regions of the view paint format
antiAlias - true, to enable antialias for rendering
Returns:
the created image.

exportToImage

public static final java.awt.image.BufferedImage exportToImage(VisualGraphView visualgraphview,
                                                               int width,
                                                               int height,
                                                               Renderer gfxRenderer,
                                                               java.awt.Insets ins,
                                                               java.awt.Color bgColor)
Exports the given VisualGraphView to an image.

Parameters:
visualgraphview - The VisualGraphView to export
width - The width of the image to create
height - The height of the image to create
gfxRenderer - The renderer to use
ins - The Insets to use as margin
bgColor - The background color for empty spaces
Returns:
The rendered image


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.