Drawing to a Canvas
It is possible to draw to the canvas using Java 2D methods using a class which implements Canvas3DChart.paint. This interface defines a single method public void paint(java.awt.Graphics g).
The object passed to the paint method is actually a Graphics2D object. Graphics is used for consistency with standard Java usage. This method is called each time the 3D chart is redrawn.
An object which implements Canvas3DChart.Paint can be registered with Canvas3DChart using either addPreRenderPaint or addPostRenderPaint. The former method causes the 2D drawing to appear beneath the 3D drawing, the latter method causes the 2D drawing to appear on top of the 3D drawing.
Since the 3D chart is redrawn many times a minute, redrawing the 2D chart each time can add quite a bit of overhead. If the 2D drawing is not dynamic, the class BufferedPaint can be used to capture the 2D drawing into an image that can be quickly redrawn for each 3D redrawing. For example, the ColormapLegend class is implemented using BufferedPaint.
PHONE: 713.784.3131 FAX:713.781.9260 |