public class ImageDisplay extends JComponent implements BasicImageDisplay, ChangeListener
MainImageDisplay
,
ImageZoom
,
ImagePanner
,
Serialized FormJComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ImageDisplay()
Construct an image display widget.
|
ImageDisplay(ImageProcessor imageProcessor,
String name)
Construct an image display widget with the given name to display
the output of the given image processor.
|
ImageDisplay(String name)
Construct an image display widget with the given name.
|
Modifier and Type | Method and Description |
---|---|
void |
addImageGraphicsHandler(ImageGraphicsHandler igh)
Register as an image graphics handler.
|
void |
clear()
Clear the image display, freeing up any resources currently used by the image
so that they can be garbage collected.
|
JComponent |
getCanvas()
Return the image canvas component.
|
CoordinateConverter |
getCoordinateConverter()
Return the object used to convert coordinates.
|
javax.media.jai.PlanarImage |
getDisplayImage()
Return the image being displayed (after image processing).
|
javax.media.jai.PlanarImage |
getImage()
Return the source image (before processing).
|
int |
getImageHeight()
Return the height of the source image in pixels
|
ImageProcessor |
getImageProcessor()
Return the image processor object.
|
int |
getImageWidth()
Return the width of the source image in pixels
|
javax.media.jai.Interpolation |
getInterpolation()
Return the interpolation object used to scale the image
|
Point2D.Double |
getOrigin()
Return the origin of the displayed image in canvas coordinates.
|
double |
getPixelValue(Point2D.Double p,
int band)
Return the value of the pixel in the given band at the given user coordinates
|
float |
getScale()
Return the current scale (zoom factor) for the image.
|
RenderingHints |
getScaleHints()
Return the optional rendering hints used for the image scale operation
|
Rectangle2D.Double |
getVisibleArea()
Return a rectangle describing the visible area of the image
(in user coordinates).
|
WorldCoordinateConverter |
getWCS()
Return the object used to convert between image and world coordinates,
or null if none was set.
|
boolean |
isAutoCenterImage()
Return true if the image is automatically centered when it is smaller than the window.
|
boolean |
isClear()
Return true if the image has been cleared.
|
boolean |
isImmediateMode()
Return true if immediate mode is turned on.
|
boolean |
isInitialized()
Return true if this widget has been initialized and is displaying an image.
|
boolean |
isPrescaled()
Return true if the image has been prescaled
|
boolean |
isWCS()
Return true if the image supports world coordinates (has the necessary keywords in the
header).
|
static void |
main(String[] args)
test main: usage: java ImageDisplay
|
void |
paintComponent(Graphics g)
Paint the image onto a Graphics object.
|
void |
removeImageGraphicsHandler(ImageGraphicsHandler igh)
Unregister as an image graphics handler.
|
void |
scaleToFit()
Set the scaling factor so that the image will fit in the current window.
|
protected void |
scaleToFit(int width,
int height)
Set the scaling factor so that the image will fit in a window of the
given size.
|
void |
setAutoCenterImage(boolean b)
Set to true (default) to automatically center the image, if it is smaller than the window.
|
void |
setImage(javax.media.jai.PlanarImage im)
Set the image to display.
|
void |
setImageProcessor(ImageProcessor imageProcessor)
Set the image processor to use to get the image to display.
|
void |
setImmediateMode(boolean b)
Set to true if scrolling and other operations should update the image immediately,
otherwise only on button release.
|
void |
setInterpolation(javax.media.jai.Interpolation i)
Set the interpolation object used to scale the image (a subclass
of Interpolation, such as InterpolationNearest (default), or
InterpolationBilinear (better, but slower)).
|
void |
setOrigin(Point2D.Double origin)
Set the origin of the image to display in canvas coordinates.
|
void |
setPrescaled(boolean b)
Set to true if the image being displayed has been prescaled (such as
for a pan window or thumbnail image).
|
void |
setScale(float scale)
Set the scale (zoom factor) for the image.
|
void |
setScale(float actualScale,
float apparentScale)
Set the scale (zoom factor) for the image, but lie about it later when asked.
|
void |
setScaleHints(RenderingHints hints)
Set the optional rendering hints for the image scale operation
|
void |
setWCS(WorldCoordinateConverter wcs)
Set the object used to convert between image and world coordinates.
|
void |
stateChanged(ChangeEvent ce)
Called for changes in the image processor settings
|
void |
updateImage()
called when the image has changed to update the display
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public ImageDisplay(ImageProcessor imageProcessor, String name)
imageProcessor
- Object managing the imagename
- name to associate with this instancepublic ImageDisplay(String name)
name
- name to associate with this instancepublic ImageDisplay()
public void setImageProcessor(ImageProcessor imageProcessor)
setImageProcessor
in interface BasicImageDisplay
public void stateChanged(ChangeEvent ce)
stateChanged
in interface ChangeListener
public ImageProcessor getImageProcessor()
getImageProcessor
in interface BasicImageReadableProcessor
getImageProcessor
in interface BasicImageDisplay
PlanarImage
public javax.media.jai.PlanarImage getImage()
getImage
in interface BasicImageDisplay
public javax.media.jai.PlanarImage getDisplayImage()
getDisplayImage
in interface BasicImageDisplay
public CoordinateConverter getCoordinateConverter()
getCoordinateConverter
in interface BasicImageDisplay
public void setImage(javax.media.jai.PlanarImage im)
setImage
in interface BasicImageDisplay
public int getImageWidth()
getImageWidth
in interface BasicImageDisplay
public int getImageHeight()
getImageHeight
in interface BasicImageDisplay
public void clear()
public boolean isClear()
public void updateImage()
updateImage
in interface BasicImageDisplay
public boolean isWCS()
isWCS
in interface BasicImageDisplay
public WorldCoordinateConverter getWCS()
getWCS
in interface BasicImageDisplay
public void setWCS(WorldCoordinateConverter wcs)
setWCS
in interface BasicImageDisplay
public void setAutoCenterImage(boolean b)
setAutoCenterImage
in interface BasicImageDisplay
public boolean isAutoCenterImage()
isAutoCenterImage
in interface BasicImageDisplay
public void paintComponent(Graphics g)
paintComponent
in class JComponent
public void addImageGraphicsHandler(ImageGraphicsHandler igh)
addImageGraphicsHandler
in interface BasicImageDisplay
public void removeImageGraphicsHandler(ImageGraphicsHandler igh)
removeImageGraphicsHandler
in interface BasicImageDisplay
public void setOrigin(Point2D.Double origin)
setOrigin
in interface BasicImageDisplay
public Point2D.Double getOrigin()
getOrigin
in interface BasicImageDisplay
public JComponent getCanvas()
getCanvas
in interface BasicImageDisplay
public void setScale(float scale)
setScale
in interface BasicImageDisplay
public void setScale(float actualScale, float apparentScale)
actualScale
- this is the scale value that is actually applied to the image dataapparentScale
- this is the scale value that will be reported by getScale()public float getScale()
getScale
in interface BasicImageDisplay
public void setInterpolation(javax.media.jai.Interpolation i)
setInterpolation
in interface BasicImageDisplay
public javax.media.jai.Interpolation getInterpolation()
getInterpolation
in interface BasicImageDisplay
public double getPixelValue(Point2D.Double p, int band)
getPixelValue
in interface BasicImageDisplay
public void setPrescaled(boolean b)
setPrescaled
in interface BasicImageDisplay
public boolean isPrescaled()
isPrescaled
in interface BasicImageDisplay
public void setScaleHints(RenderingHints hints)
setScaleHints
in interface BasicImageDisplay
public RenderingHints getScaleHints()
getScaleHints
in interface BasicImageDisplay
protected void scaleToFit(int width, int height)
Note that only integer scaling factors are used, for example 2, 1, 1/2, 1/3, etc., for performance reasons.
public void scaleToFit()
Note that only integer scaling factors are used, for example 2, 1, 1/2, 1/3, etc., for performance reasons.
scaleToFit
in interface BasicImageDisplay
public Rectangle2D.Double getVisibleArea()
getVisibleArea
in interface BasicImageReadableProcessor
getVisibleArea
in interface BasicImageDisplay
public boolean isInitialized()
isInitialized
in interface BasicImageDisplay
public void setImmediateMode(boolean b)
setImmediateMode
in interface BasicImageDisplay
public boolean isImmediateMode()
isImmediateMode
in interface BasicImageDisplay
public static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.