com.vistech.jai.render
Class RenderedImageCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.vistech.jai.render.JAIImageCanvas
                          |
                          +--com.vistech.jai.render.RenderedImageCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, ScrollController, java.io.Serializable
Direct Known Subclasses:
ImageManipulatorCanvas, TiledRenderableImageCanvas

public class RenderedImageCanvas
extends JAIImageCanvas

A component class for drawing large rendered images. This class has several properties to represent different attributes of a rendered image. These properties include tile width, tile height, current transformation and color model. When a new image is set, it is reformatted using the "format" operator with the current tile width and height settings. This class implements the ScrollController interface, so images displayed in this component can be scrolled. To scroll a large image, only the tiles that are visible are computed. These tiles are converted into a BufferedImage object, which are then drawn over the components graphics context.

Version:
1.0 18 Apr 2000
Author:
Lawrence Rodrigues
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.image.ColorModel colorModel
           
protected  javax.media.jai.PlanarImage displayImage
           
protected  int imageHeight
           
protected  int imageWidth
           
protected  int maxTileCordX
           
protected  int maxTileCordY
           
protected  int maxTileIndexX
           
protected  int maxTileIndexY
           
protected  int minTileCordX
           
protected  int minTileCordY
           
protected  int minTileIndexX
           
protected  int minTileIndexY
           
protected  javax.media.jai.PlanarImage origImage
           
protected  java.awt.image.SampleModel sampleModel
           
protected  javax.media.jai.TileCache tc
           
protected  int tileGridXOffset
           
protected  int tileGridYOffset
           
protected  int tileHeight
           
protected  int tileWidth
           
protected  int viewerHeight
           
protected  int viewerWidth
           
 
Fields inherited from class com.vistech.jai.render.JAIImageCanvas
atx, height, image, imageDrawn, MAX_HEIGHT, MAX_WIDTH, panOffset, panX, panY, scrollAnchor, scrollOn, vpPos, width
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RenderedImageCanvas()
           
RenderedImageCanvas(javax.media.jai.PlanarImage img)
          The RenderedImageCanvas constructor.
 
Method Summary
protected  void fireTilePropertyChange()
          Fires property change events for the following properties: maxTileIndexX, maxTileIndexY,tileWidth,tileHeight, and transform.
 javax.media.jai.PlanarImage getDisplayImage()
          Returns the displayed image.
 int getImageHeight()
          Returns the height of the current image.
 int getImageWidth()
          Returns the width of the current image.
 int getMaxTileIndexX()
          Returns the maxTileIndexX property of the current image.
 int getMaxTileIndexY()
          Returns the maxTileIndexY property of the current image.
 int getTileHeight()
          Returns the tile height of the formatted image.
protected  void getTileInfo(javax.media.jai.PlanarImage img)
          Computes tile information of the specified image.
 int getTileWidth()
          Returns the tile width of the formatted image.
protected  javax.media.jai.RenderedOp makeTiledImage(javax.media.jai.PlanarImage img)
           
 void paintComponent(java.awt.Graphics gc)
          Paints the tiles that are visible.
 void setImage(javax.media.jai.PlanarImage img)
          Sets the image.
 void setTileHeight(int th)
          Sets the tile height of the formatted image.
 void setTileWidth(int tw)
          Sets the tile width of the formatted image.
 
Methods inherited from class com.vistech.jai.render.JAIImageCanvas
getImage, getPanOffset, getScrollOn, getTransform, getViewportPosition, isImageDrawn, pan, reset, scroll, setPanOffset, setScrollOn, setTransform, setViewportPosition, startScroll, stopScroll
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

viewerWidth

protected int viewerWidth

viewerHeight

protected int viewerHeight

displayImage

protected transient javax.media.jai.PlanarImage displayImage

origImage

protected transient javax.media.jai.PlanarImage origImage

tileWidth

protected int tileWidth

tileHeight

protected int tileHeight

sampleModel

protected transient java.awt.image.SampleModel sampleModel

colorModel

protected java.awt.image.ColorModel colorModel

maxTileIndexX

protected int maxTileIndexX

maxTileIndexY

protected int maxTileIndexY

maxTileCordX

protected int maxTileCordX

maxTileCordY

protected int maxTileCordY

minTileIndexX

protected int minTileIndexX

minTileIndexY

protected int minTileIndexY

minTileCordX

protected int minTileCordX

minTileCordY

protected int minTileCordY

tileGridXOffset

protected int tileGridXOffset

tileGridYOffset

protected int tileGridYOffset

imageWidth

protected int imageWidth

imageHeight

protected int imageHeight

tc

protected javax.media.jai.TileCache tc
Constructor Detail

RenderedImageCanvas

public RenderedImageCanvas()

RenderedImageCanvas

public RenderedImageCanvas(javax.media.jai.PlanarImage img)
The RenderedImageCanvas constructor.
Parameters:
img - the planar image.
Method Detail

setImage

public void setImage(javax.media.jai.PlanarImage img)
Sets the image.
Overrides:
setImage in class JAIImageCanvas
Parameters:
img - the planar image.

getDisplayImage

public javax.media.jai.PlanarImage getDisplayImage()
Returns the displayed image.
Overrides:
getDisplayImage in class JAIImageCanvas
Returns:
the displayed image.

makeTiledImage

protected javax.media.jai.RenderedOp makeTiledImage(javax.media.jai.PlanarImage img)

getTileInfo

protected void getTileInfo(javax.media.jai.PlanarImage img)
Computes tile information of the specified image.
Parameters:
img - the planar image.

setTileWidth

public void setTileWidth(int tw)
Sets the tile width of the formatted image.
Parameters:
int - the tile width.

setTileHeight

public void setTileHeight(int th)
Sets the tile height of the formatted image.
Parameters:
int - the tile height.

getTileWidth

public int getTileWidth()
Returns the tile width of the formatted image.
Returns:
the tile width of the formatted image.

getTileHeight

public int getTileHeight()
Returns the tile height of the formatted image.
Returns:
the tile height of the formatted image.

getMaxTileIndexX

public int getMaxTileIndexX()
Returns the maxTileIndexX property of the current image.
Returns:
the maxTileIndexX property of the current image.

getMaxTileIndexY

public int getMaxTileIndexY()
Returns the maxTileIndexY property of the current image.
Returns:
the maxTileIndexY property of the current image.

getImageWidth

public int getImageWidth()
Returns the width of the current image.
Returns:
the width of the current image.

getImageHeight

public int getImageHeight()
Returns the height of the current image.
Returns:
the height of the current image.

fireTilePropertyChange

protected void fireTilePropertyChange()
Fires property change events for the following properties: maxTileIndexX, maxTileIndexY,tileWidth,tileHeight, and transform.

paintComponent

public void paintComponent(java.awt.Graphics gc)
Paints the tiles that are visible. This method first computes only the tiles that are visible. Each of the tiles is converted into a BufferedImage object, which is then drawn over the components graphics context.
Overrides:
paintComponent in class JAIImageCanvas
Parameters:
gc - the graphics context.