com.davisor.graphics.chart
Class BufferedChart

java.lang.Object
  extended bycom.davisor.graphics.chart.AbstractChart
      extended bycom.davisor.graphics.chart.ImageChart
          extended bycom.davisor.graphics.chart.BufferedChart
All Implemented Interfaces:
Chart, java.io.Serializable

public class BufferedChart
extends ImageChart

BufferedChart represents a drawable chart, based on a buffered image.

Since:
JDK1.2
See Also:
BufferedImage, ChartAttributes, ChartFactory, Serialized Form

Field Summary
 
Fields inherited from class com.davisor.graphics.chart.ImageChart
M_backArea, M_graphics, M_image, M_imageParams, M_plotArea
 
Fields inherited from class com.davisor.graphics.chart.AbstractChart
M_annotatedShapes, M_contentType, M_height, M_resolution, M_width
 
Constructor Summary
  BufferedChart(BufferedChart bc)
          Shallow copy constructor.
protected BufferedChart(java.lang.Number width, java.lang.Number height, java.lang.Number resolution, java.lang.String contentType, java.util.List annotatedShapes)
          Creates a new image chart.
  BufferedChart(java.lang.String contentType, ChartAttributes attr)
          Creates a chart out of the given factory and attributes.
 
Method Summary
 java.awt.Image getImage()
          Gets chart image.
protected  void setAntialiasDefaults(ChartAttributes attr)
          Sets current graphics' context antialias default rendering hints.
 
Methods inherited from class com.davisor.graphics.chart.ImageChart
getAnnotatedShapes, getBackArea, getGraphics, getImageParams, getPlotArea, putContent, putImage, putImage, putImage, putImage, setAntialiasMode, setAntialiasMode, writeReplace
 
Methods inherited from class com.davisor.graphics.chart.AbstractChart
addAnnotatedShape, getContentType, getHeight, getHeightInMillimeters, getResolution, getSizeInMillimeters, getWidth, getWidthInMillimeters, putChart, putChart, setContentType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedChart

public BufferedChart(BufferedChart bc)
Shallow copy constructor.


BufferedChart

protected BufferedChart(java.lang.Number width,
                        java.lang.Number height,
                        java.lang.Number resolution,
                        java.lang.String contentType,
                        java.util.List annotatedShapes)
Creates a new image chart.

Parameters:
width - chart width, in millimeters (may be null)
height - chart height, in millimeters (may be null)
resolution - resolution, in pixels-per-millimeters (may be null)
contentType - chart content encoding type (may be null)
annotatedShapes - list of annotated shapes (may be null)

BufferedChart

public BufferedChart(java.lang.String contentType,
                     ChartAttributes attr)
Creates a chart out of the given factory and attributes. The chart image will be a buffered image of the given size and of the TYPE_INT_ARGB image type. This image type is always used, regardless of the target image encoding scheme, as the type supports alpha blending, it is fast, it has good color accuracy and conservative memory requirements.

After the creation, the image will first be filled with the chart background color. If the chart render attributes also define a stroke, then a borderline of the given color is drawn around the chart. If the color is not set, black color is used as default.

After the image has been created, a rectangle object is created to record the inner bounds of the drawable area of the image. If a borderline was drawn around the image, the border area is reduced from the bounds.

A graphics' context is also created for the image. If a borderline was drawn around the image, an initial translation is added to the context, so that the context origo coincides with the left upper corner of the drawable area inside the border line. The context rendering hints are configured as described by the chart attributes.

Parameters:
contentType - chart content encoding type (may be null)
attr - chart attributes
See Also:
ImageChart.getBackArea(), ImageChart.getGraphics(), ImageChart.getPlotArea(), BufferedImage
Method Detail

getImage

public java.awt.Image getImage()
Gets chart image.

Overrides:
getImage in class ImageChart
See Also:
ImageChart.getGraphics()

setAntialiasDefaults

protected void setAntialiasDefaults(ChartAttributes attr)
Sets current graphics' context antialias default rendering hints.

This implementation determines if the current image is an indexed buffered image, if it defines a transparent color, and if antialias mode is RenderAttributes.AUTO. If so, antialiasing is turned off, because such a combination does not look good. Othewise, default antialias defaults are used instead, as defined by ImageChart.setAntialiasDefaults(ChartAttributes).

Overrides:
setAntialiasDefaults in class ImageChart
Parameters:
attr - attributes to read encoder info from
See Also:
ChartAttributes.getEncoderInfo(), MimeInfo, MimeInfo#configureHints


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.