com.tensegrity.graph.view.image
Class ImageExportConfiguration

java.lang.Object
  extended bycom.tensegrity.graph.view.image.ImageExportConfiguration

public class ImageExportConfiguration
extends java.lang.Object

ImageExportConfiguration holds the settings used to export an image from a VisualGraphView.

This class is used with the ImageExportViewConfigurator and ImageExporter.

Author:
BurkhardWick

Field Summary
static int ALIGNMENT_BOTTOM
          Constant for bottom alignment
static int ALIGNMENT_CENTER
          Constant for center alignment
static int ALIGNMENT_LEFT
          Constant for left alignment
static int ALIGNMENT_RIGHT
          Constant for right alignment
static int ALIGNMENT_TOP
          Constant for top alignment
static int MODE_ACTUAL_SIZE
          Mode for: The view will be rendered 1:1, width and height values are ignored
static int MODE_BEST_FIT
          Mode for: The image is resized to fit into the given boundary while the aspect ratio is preserved.
static int MODE_BEST_FIT_CROPPED
          Mode for: The image is resized to fit into the given boundary while the aspect ratio is preserved.
static int MODE_CROP_FIT
          Mode for: The image is resized so the smallest extension (width or height) fits into the given boundary.
static int MODE_NO_FIT
          Mode for: No resizing is done.
static int MODE_STRETCHED
          Mode for: The image is stretched to the given width and height ignoring the aspect ration, so the result might look distorted.
 
Constructor Summary
ImageExportConfiguration()
           
 
Method Summary
 Color getBackgroundColor()
          Returns the background color that is used for regions in the image outside of the view.
 int getHeight()
          Returns the height of the image.
 int getHorizontalAlignment()
          Returns the horizontal alignment that is used if the width of the view is different than the width of the image.
 Boundary getInsets()
          Returns the insets that should be used to create a margin between the boundaries of the view and the image boundaries.
 int getMode()
          Returns the image export mode
 Renderer getRenderer()
          Returns the renderer that will be used for rendering the image
 Transform2D getTransform()
          Returns the Transform2D instance that can be used to transform graph coordinates to image coordinates.
 int getVerticalAlignment()
          Returns the vertical alignment that is used if the height of the view is different than the height of the image.
 int getWidth()
          Returns the width of the image.
 boolean isAntialias()
          Returns true, if the antialias is turned on.
 boolean isPreserveRatio()
          Returns true, if the aspect ratio of the view is preserved for rendering.
 void setAntialias(boolean antialias)
          Turns on/off the antialias for rendering.
 void setBackgroundColor(Color color)
          Sets the background color that is used for regions in the image outside of the view.
 void setHeight(int height)
          Sets the height of the image.
 void setHorizontalAlignment(int alignment)
          Sets the horizontal alignment that is used if the width of the view is different than the width of the image.
 void setInsets(Boundary insets)
          Sets the insets that should be used to create a margin between the boundaries of the view and the image boundaries.
 void setInsets(int left, int top, int right, int bottom)
          Sets the insets that should be used to create a margin between the boundaries of the view and the image boundaries.
 void setMode(int mode)
          Sets the image export mode
 void setRenderer(Renderer renderer)
          Sets the renderer that will be used for rendering the image
 void setVerticalAlignment(int alignment)
          Sets the vertical alignment that is used if the height of the view is different than the height of the image.
 void setWidth(int width)
          Sets the width of the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_ACTUAL_SIZE

public static final int MODE_ACTUAL_SIZE
Mode for: The view will be rendered 1:1, width and height values are ignored

See Also:
Constant Field Values

MODE_BEST_FIT

public static final int MODE_BEST_FIT
Mode for: The image is resized to fit into the given boundary while the aspect ratio is preserved. You may set an alignment of the image by using setHorizontalAlignment(int) and setVerticalAlignment(int). You can set a background color for the space outside of the rendered graph width #setBackgroundColor(int).

See Also:
Constant Field Values

MODE_BEST_FIT_CROPPED

public static final int MODE_BEST_FIT_CROPPED
Mode for: The image is resized to fit into the given boundary while the aspect ratio is preserved. Afterwards the empty space around the graph is cut off, so the resulting image might have a smaller width or height than the given boundary.

See Also:
Constant Field Values

MODE_CROP_FIT

public static final int MODE_CROP_FIT
Mode for: The image is resized so the smallest extension (width or height) fits into the given boundary. This usually means that the image is cropped.

See Also:
Constant Field Values

MODE_STRETCHED

public static final int MODE_STRETCHED
Mode for: The image is stretched to the given width and height ignoring the aspect ration, so the result might look distorted.

See Also:
Constant Field Values

MODE_NO_FIT

public static final int MODE_NO_FIT
Mode for: No resizing is done. The view is aligned in the given boundaries using the alignment options and might be cropped. You can set a background color for the space outside of the rendered graph width #setBackgroundColor(int).

See Also:
Constant Field Values

ALIGNMENT_CENTER

public static final int ALIGNMENT_CENTER
Constant for center alignment

See Also:
Constant Field Values

ALIGNMENT_LEFT

public static final int ALIGNMENT_LEFT
Constant for left alignment

See Also:
Constant Field Values

ALIGNMENT_TOP

public static final int ALIGNMENT_TOP
Constant for top alignment

See Also:
Constant Field Values

ALIGNMENT_RIGHT

public static final int ALIGNMENT_RIGHT
Constant for right alignment

See Also:
Constant Field Values

ALIGNMENT_BOTTOM

public static final int ALIGNMENT_BOTTOM
Constant for bottom alignment

See Also:
Constant Field Values
Constructor Detail

ImageExportConfiguration

public ImageExportConfiguration()
Method Detail

getMode

public int getMode()
Returns the image export mode

Returns:
the image export mode

setMode

public void setMode(int mode)
Sets the image export mode

Parameters:
mode - the image export mode

getRenderer

public Renderer getRenderer()
Returns the renderer that will be used for rendering the image

Returns:
the renderer that will be used for rendering the image

setRenderer

public void setRenderer(Renderer renderer)
Sets the renderer that will be used for rendering the image

Parameters:
renderer - the renderer that will be used for rendering the image

getWidth

public int getWidth()
Returns the width of the image. This is not necessarily the size of the rendered image, because it might be altered in some modes while preparing the view.

Returns:
the width of the image

setWidth

public void setWidth(int width)
Sets the width of the image. This is not necessarily the size of the rendered image, because it might be altered in some modes while preparing the view.

Parameters:
width - the width of the image

getHeight

public int getHeight()
Returns the height of the image. This is not necessarily the size of the rendered image, because it might be altered in some modes while preparing the view.

Returns:
the height of the image

setHeight

public void setHeight(int height)
Sets the height of the image. This is not necessarily the size of the rendered image, because it might be altered in some modes while preparing the view.

Parameters:
height - the height of the image

getInsets

public Boundary getInsets()
Returns the insets that should be used to create a margin between the boundaries of the view and the image boundaries.

Returns:
the insets

setInsets

public void setInsets(Boundary insets)
Sets the insets that should be used to create a margin between the boundaries of the view and the image boundaries.

Parameters:
insets - the insets

setInsets

public void setInsets(int left,
                      int top,
                      int right,
                      int bottom)
Sets the insets that should be used to create a margin between the boundaries of the view and the image boundaries.

Parameters:
left - the margin for the left side
top - the margin for the top side
right - the margin for the right side
bottom - the margin for the bottom side

isPreserveRatio

public boolean isPreserveRatio()
Returns true, if the aspect ratio of the view is preserved for rendering. This value just depends on the mode and can't be set directly.

Returns:
true, if the aspect ratio of the view is preserved for rendering

isAntialias

public boolean isAntialias()
Returns true, if the antialias is turned on.

Returns:
true, if the antialias is turned on.

setAntialias

public void setAntialias(boolean antialias)
Turns on/off the antialias for rendering.

Parameters:
antialias - true to enable antialias

getHorizontalAlignment

public int getHorizontalAlignment()
Returns the horizontal alignment that is used if the width of the view is different than the width of the image. Can be one of the alignment constants defined in this class.

Returns:
the horizontal alignment

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
Sets the horizontal alignment that is used if the width of the view is different than the width of the image. Can be one of the alignment constants defined in this class.

Parameters:
alignment - the horizontal alignment

getVerticalAlignment

public int getVerticalAlignment()
Returns the vertical alignment that is used if the height of the view is different than the height of the image. Can be one of the alignment constants defined in this class.

Returns:
the vertical alignment

setVerticalAlignment

public void setVerticalAlignment(int alignment)
Sets the vertical alignment that is used if the height of the view is different than the height of the image. Can be one of the alignment constants defined in this class.

Parameters:
alignment - the vertical alignment

getBackgroundColor

public Color getBackgroundColor()
Returns the background color that is used for regions in the image outside of the view.

Returns:
the background color

setBackgroundColor

public void setBackgroundColor(Color color)
Sets the background color that is used for regions in the image outside of the view.

Parameters:
color - the background color

getTransform

public Transform2D getTransform()
Returns the Transform2D instance that can be used to transform graph coordinates to image coordinates. This value is available after the image has been rendered.

Returns:
the transformation from graph coordinates to image coordinates


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