NetCharts Pro

netcharts.pro.common
Class NFImageGeneration

java.lang.Object
  |
  +--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/cur
  image/xpm
  image/xbm
  image/x-cmu-raster
  image/ico
  image/pcx
  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 MIM 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_PICT
          PICT (image/pict)
static java.lang.String MIME_TYPE_PNG
          PNG (image/png)
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, java.lang.String mimeType)
          Generates an image of the given graph.
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 NFServerGeneratedImage getServerGeneratedImage(NFGraph graph, java.lang.String mimeType, java.lang.String textDescription, boolean createImageMap)
          Outputs the chart to NFServerGeneratedImage object, using the mime type format specified.
static void setJPGQuality(int quality)
          Sets the The compression versus quality factor used when generating JPEG images.
static void setPNGTransparency(boolean transparent)
          Specifies whether or not transparent backgrounds will be supported in the PNG images of charts generated.
static void setTIFFCompression(int compression)
          Sets the compression type to use when creating TIFF images.
static void writeImage(NFGraph graph, java.lang.String mimeType, java.io.OutputStream outputStream)
          Generates an image of the given graph and writes it to the provided output stream
 
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.

COMPRESSION_PACKBITS

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

COMPRESSION_GROUP3_1D

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

Not currently supported.


COMPRESSION_GROUP3_2D

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

Not currently supported.


COMPRESSION_GROUP4

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

Not currently supported.


COMPRESSION_JPEG_TTN2

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

COMPRESSION_DEFLATE

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

MIME_TYPE_PNG

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

MIME_TYPE_TIFF

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

MIME_TYPE_JPG

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

MIME_TYPE_BMP

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

MIME_TYPE_TGA

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

MIME_TYPE_XPM

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

MIME_TYPE_XBM

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

MIME_TYPE_PICT

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

MIME_TYPE_WBMP

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

DEFAULT_MIME_TYPE

public static final java.lang.String DEFAULT_MIME_TYPE
Default MIM type. Equal to MIME_TYPE_PNG.
Constructor Detail

NFImageGeneration

public NFImageGeneration()
Method Detail

setTIFFCompression

public static void setTIFFCompression(int compression)
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.

setJPGQuality

public static void setJPGQuality(int quality)
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.

setPNGTransparency

public static void setPNGTransparency(boolean transparent)
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); Currently, the transparency can be seen in the following browsers: Netscape 7 Mozilla IE 5.5 for Mac By default PNG transparency is disabled.
Parameters:
transparent - Whether or not transparent backgrounds will be supported in the PNG images of charts generated.

getServerGeneratedImage

public static NFServerGeneratedImage getServerGeneratedImage(NFGraph graph,
                                                             java.lang.String mimeType,
                                                             java.lang.String textDescription,
                                                             boolean createImageMap)
                                                      throws java.lang.Exception
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.

writeImage

public static void writeImage(NFGraph graph,
                              java.lang.String mimeType,
                              java.io.OutputStream outputStream)
                       throws java.lang.Exception
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.

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.

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.
 

generateImage

public static byte[] generateImage(NFGraph graph,
                                   java.lang.String mimeType)
                            throws java.lang.Exception
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

NetCharts Pro


Visual Mining, Inc.
15825 Shady Grove Rd.
Suite 20
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2006
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: Apr 14, 2006