NetCharts Pro

netcharts.pro.common
Class NFImageGeneration

java.lang.Object
  extended by netcharts.pro.common.NFImageGeneration

public class NFImageGeneration
extends java.lang.Object

This class provides powerful methods for generating images and image map data. For a simpler/quicker implementation for server side image generation, you may wish to use the methods in the NFServletUtil class.

The following image types are supported:

  image/bmp
  image/jpeg
  image/pict
  image/png
  image/psd
  image/tga
  image/tiff
  image/xpm
  image/xbm
  image/x-cmu-raster
  image/pcx
  image/svg+xml
  image/wbmp


Field Summary
static int COMPRESSION_DEFLATE
          DEFLATE lossless compression (also known as "Zip-in-TIFF").
static int COMPRESSION_GROUP3_1D
          Modified Huffman Compression (CCITT Group 3 1D facsimile compression).
static int COMPRESSION_GROUP3_2D
          CCITT T.4 bilevel compression (CCITT Group 3 2D facsimile compression).
static int COMPRESSION_GROUP4
          CCITT T.6 bilevel compression (CCITT Group 4 facsimile compression).
static int COMPRESSION_JPEG_TTN2
          JPEG-in-TIFF compression.
static int COMPRESSION_NONE
          No compression.
static int COMPRESSION_PACKBITS
          Byte-oriented run-length encoding "PackBits" compression.
static java.lang.String DEFAULT_MIME_TYPE
          Default MIME type.
static java.lang.String MIME_TYPE_BMP
          BMP (image/bmp)
static java.lang.String MIME_TYPE_JPG
          JPG (image/jpg)
static java.lang.String MIME_TYPE_PCX
          PCX (image/pcx)
static java.lang.String MIME_TYPE_PICT
          PICT (image/pict)
static java.lang.String MIME_TYPE_PNG
          PNG (image/png)
static java.lang.String MIME_TYPE_SVG
          SVG (image/svg+xml)
static java.lang.String MIME_TYPE_TGA
          TGA (image/tga)
static java.lang.String MIME_TYPE_TIFF
          TIFF (image/tiff)
static java.lang.String MIME_TYPE_WBMP
          WBMP (image/wbmp)
static java.lang.String MIME_TYPE_XBM
          XBM (image/xbm)
static java.lang.String MIME_TYPE_XPM
          XPM (image/xpm)
 
Constructor Summary
NFImageGeneration()
           
 
Method Summary
static byte[] generateImage(NFGraph graph, NFImageParams params)
          Generates an image of the given graph.
static byte[] generateImage(NFGraph graph, java.lang.String mimeType)
          Deprecated. Use generateImage(NFGraph, NFImageParams)
static java.awt.Image getAWTImage(NFGraph graph)
          Generates a java.awt.Image of the given graph.
static java.awt.Image getAWTImage(NFGraph graph, int imageType)
          Generates a java.awt.Image of the given graph.
static int getJPGQuality()
          Deprecated.  
static boolean getPNGTransparency()
          Deprecated.  
static NFServerGeneratedImage getServerGeneratedImage(NFGraph graph, NFImageParams params)
          Outputs the chart to NFServerGeneratedImage object, using the image parameters specified.
static NFServerGeneratedImage getServerGeneratedImage(NFGraph graph, java.lang.String mimeType, java.lang.String textDescription, boolean createImageMap)
          Deprecated. Use getServerGeneratedImage(NFGraph, NFImageParams)
static int getTIFFCompression()
          Deprecated.  
static void setJPGQuality(int quality)
          Deprecated. Use the appropriate method in the JPG image params object.
static void setPNGTransparency(boolean transparent)
          Deprecated. Use the appropriate method in the PNG image params object.
static void setTIFFCompression(int compression)
          Deprecated. Use the appropriate method in the TIFF image params object.
static void writeImage(NFGraph graph, java.lang.String mimeType, java.io.OutputStream outputStream)
          Deprecated. Write to the OutputStream using the result of calling generateImage(NFGraph, NFImageParams)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPRESSION_NONE

public static final int COMPRESSION_NONE
No compression.

See Also:
Constant Field Values

COMPRESSION_PACKBITS

public static final int COMPRESSION_PACKBITS
Byte-oriented run-length encoding "PackBits" compression.

See Also:
Constant Field Values

COMPRESSION_GROUP3_1D

public static final int COMPRESSION_GROUP3_1D
Modified Huffman Compression (CCITT Group 3 1D facsimile compression).

Not currently supported.

See Also:
Constant Field Values

COMPRESSION_GROUP3_2D

public static final int COMPRESSION_GROUP3_2D
CCITT T.4 bilevel compression (CCITT Group 3 2D facsimile compression).

Not currently supported.

See Also:
Constant Field Values

COMPRESSION_GROUP4

public static final int COMPRESSION_GROUP4
CCITT T.6 bilevel compression (CCITT Group 4 facsimile compression).

Not currently supported.

See Also:
Constant Field Values

COMPRESSION_JPEG_TTN2

public static final int COMPRESSION_JPEG_TTN2
JPEG-in-TIFF compression.

See Also:
Constant Field Values

COMPRESSION_DEFLATE

public static final int COMPRESSION_DEFLATE
DEFLATE lossless compression (also known as "Zip-in-TIFF").

See Also:
Constant Field Values

MIME_TYPE_PNG

public static final java.lang.String MIME_TYPE_PNG
PNG (image/png)

See Also:
Constant Field Values

MIME_TYPE_TIFF

public static final java.lang.String MIME_TYPE_TIFF
TIFF (image/tiff)

See Also:
Constant Field Values

MIME_TYPE_JPG

public static final java.lang.String MIME_TYPE_JPG
JPG (image/jpg)

See Also:
Constant Field Values

MIME_TYPE_BMP

public static final java.lang.String MIME_TYPE_BMP
BMP (image/bmp)

See Also:
Constant Field Values

MIME_TYPE_TGA

public static final java.lang.String MIME_TYPE_TGA
TGA (image/tga)

See Also:
Constant Field Values

MIME_TYPE_XPM

public static final java.lang.String MIME_TYPE_XPM
XPM (image/xpm)

See Also:
Constant Field Values

MIME_TYPE_XBM

public static final java.lang.String MIME_TYPE_XBM
XBM (image/xbm)

See Also:
Constant Field Values

MIME_TYPE_PICT

public static final java.lang.String MIME_TYPE_PICT
PICT (image/pict)

See Also:
Constant Field Values

MIME_TYPE_WBMP

public static final java.lang.String MIME_TYPE_WBMP
WBMP (image/wbmp)

See Also:
Constant Field Values

DEFAULT_MIME_TYPE

public static final java.lang.String DEFAULT_MIME_TYPE
Default MIME type. Equal to MIME_TYPE_PNG.

See Also:
Constant Field Values

MIME_TYPE_SVG

public static final java.lang.String MIME_TYPE_SVG
SVG (image/svg+xml)

See Also:
Constant Field Values

MIME_TYPE_PCX

public static final java.lang.String MIME_TYPE_PCX
PCX (image/pcx)

See Also:
Constant Field Values
Constructor Detail

NFImageGeneration

public NFImageGeneration()
Method Detail

setTIFFCompression

public static void setTIFFCompression(int compression)
Deprecated. Use the appropriate method in the TIFF image params object.

Sets the compression type to use when creating TIFF images. One of COMPRESSION_NONE, COMPRESSION_PACKBITS (default), COMPRESSION_GROUP3_1D, COMPRESSION_GROUP3_2D, COMPRESSION_JPEG_TTN2 or COMPRESSION_DEFLATE.

Parameters:
compression - The type of compression to use.

getTIFFCompression

public static int getTIFFCompression()
Deprecated. 


setJPGQuality

public static void setJPGQuality(int quality)
Deprecated. Use the appropriate method in the JPG image params object.

Sets the The compression versus quality factor used when generating JPEG images. Valid values are 0 to 100. The higher the value, the less compression will be used and better quality, but also larger file size. The default value used is 75.

Parameters:
quality - The quality level.

getJPGQuality

public static int getJPGQuality()
Deprecated. 


setPNGTransparency

public static void setPNGTransparency(boolean transparent)
Deprecated. Use the appropriate method in the PNG image params object.

Specifies whether or not transparent backgrounds will be supported in the PNG images of charts generated. Specify a color, concatenated with '_0', in the Background parameter of the chart to display a transparent background. Example: Background = (white_0,NONE,1,"null",TILE,black); The transparency can be in most modern browsers. By default PNG transparency is enabled.

Parameters:
transparent - Whether or not transparent backgrounds will be supported in the PNG images of charts generated.

getPNGTransparency

public static boolean getPNGTransparency()
Deprecated. 


getServerGeneratedImage

public static NFServerGeneratedImage getServerGeneratedImage(NFGraph graph,
                                                             java.lang.String mimeType,
                                                             java.lang.String textDescription,
                                                             boolean createImageMap)
                                                      throws java.lang.Exception
Deprecated. Use getServerGeneratedImage(NFGraph, NFImageParams)

Outputs the chart to NFServerGeneratedImage object, using the mime type format specified. The NFServerGeneratedImage object will store both the image and map data. Throws exceptions if the Image or Graphics objects cannot be created for the chart, or if not properly licensed.

Parameters:
graph - The graph object to generate an image for.
mimeType - the mime type format for the chart image created.
textDescription - The value to use in the ALT tag
createImageMap - generate the image map or not.
Throws:
java.lang.Exception

getServerGeneratedImage

public static NFServerGeneratedImage getServerGeneratedImage(NFGraph graph,
                                                             NFImageParams params)
                                                      throws java.lang.Exception
Outputs the chart to NFServerGeneratedImage object, using the image parameters specified. The NFServerGeneratedImage object will store both the image and map data. Throws exceptions if the Image or Graphics objects cannot be created for the chart, or if not properly licensed.

Parameters:
graph - The graph object to generate an image for.
params - The image generation parameters
Throws:
java.lang.Exception

writeImage

public static void writeImage(NFGraph graph,
                              java.lang.String mimeType,
                              java.io.OutputStream outputStream)
                       throws java.lang.Exception
Deprecated. Write to the OutputStream using the result of calling generateImage(NFGraph, NFImageParams)

Generates an image of the given graph and writes it to the provided output stream

Parameters:
graph - The graph object to generate an image for.
mimeType - The mime type format for the chart image created.
outputStream - The stream to write the image bytes to.
Throws:
java.lang.Exception

getAWTImage

public static java.awt.Image getAWTImage(NFGraph graph)
                                  throws java.lang.Exception
Generates a java.awt.Image of the given graph. No encoding is performed.

Parameters:
graph - The graph object to generate a java.awt.Image of.
Throws:
java.lang.Exception

getAWTImage

public static java.awt.Image getAWTImage(NFGraph graph,
                                         int imageType)
                                  throws java.lang.Exception
Generates a java.awt.Image of the given graph. No encoding is performed.

Parameters:
graph - The graph object to generate a java.awt.Image of.
imageType - The image type to create. Examples include:
 java.awt.image.BufferedImage.TYPE_BYTE_INDEXED
 java.awt.image.BufferedImage.TYPE_BYTE_BINARY
 java.awt.image.BufferedImage.TYPE_INT_ARGB
 etc.
 
Throws:
java.lang.Exception

generateImage

public static byte[] generateImage(NFGraph graph,
                                   java.lang.String mimeType)
                            throws java.lang.Exception
Deprecated. Use generateImage(NFGraph, NFImageParams)

Generates an image of the given graph.

Parameters:
graph - The graph object to generate an image for.
mimeType - The mime type format for the chart image created.
Returns:
encoded image bytes
Throws:
java.lang.Exception

generateImage

public static byte[] generateImage(NFGraph graph,
                                   NFImageParams params)
                            throws java.lang.Exception
Generates an image of the given graph.

Parameters:
graph - The graph object to generate an image for.
params - The image generation parameters
Returns:
encoded image bytes
Throws:
java.lang.Exception

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 28, 2011