Class ImageDisplay

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  ImageDisplay.ImgDisplayMouseListener  
      protected class  ImageDisplay.LoadImageRunnable
      The thread that reads the images.
      private class  ImageDisplay.UpdateImageThread  
      static class  ImageDisplay.VisRect
      Manage the visible rectangle of an image with full bounds stored in init.
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageDisplay()
      Constructs a new ImageDisplay with no image processor.
      ImageDisplay​(ImageProcessor imageProcessor)
      Constructs a new ImageDisplay with a given image processor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static ImageDisplay.VisRect calculateDrawImageRectangle​(ImageDisplay.VisRect visibleRect, java.awt.Dimension compSize)
      calculateDrawImageRectangle
      (package private) static ImageDisplay.VisRect calculateDrawImageRectangle​(ImageDisplay.VisRect imgRect, java.awt.Rectangle compRect)
      calculateDrawImageRectangle
      (package private) static java.awt.Point comp2imgCoord​(ImageDisplay.VisRect visibleRect, int xComp, int yComp, java.awt.Dimension compSize)  
      void destroy()
      Called when the object has been destroyed.
      private void ensureMaxZoom​(java.awt.Rectangle rectangle)
      Ensure that a rectangle isn't zoomed in too much
      void filterChanged()
      Invoked when the filter is changed.
      (package private) static java.awt.Point getCenterImgCoord​(java.awt.Rectangle visibleRect)  
      private IImageViewer getIImageViewer​(IImageEntry<?> entry)
      Get the image viewer for an entry
      Vector3D getRotation​(IImageEntry<?> entry)
      Get the rotation in the image viewer for an entry
      (package private) static java.awt.Point img2compCoord​(ImageDisplay.VisRect visibleRect, int xImg, int yImg, java.awt.Dimension compSize)  
      void paintComponent​(java.awt.Graphics g)  
      private void paintErrorMessage​(java.awt.Graphics g, IImageEntry<?> imageEntry, IImageEntry<?> oldImageEntry, java.awt.image.BufferedImage bufferedImage, boolean currentErrorLoading, java.awt.Dimension size)
      Paint an error message
      private void paintOsdText​(java.awt.Graphics g)
      Paint OSD text
      private void paintSelectedRect​(java.awt.Graphics g, java.awt.Rectangle target, ImageDisplay.VisRect visibleRectTemp, java.awt.Dimension size)
      Paint the selected rectangle
      void preferenceChanged​(PreferenceChangeEvent e)
      Triggered when a preference entry value changes.
      void setEmptyText​(java.lang.String emptyText)
      Set the message displayed when there is no image to display.
      java.util.concurrent.Future<?> setImage​(IImageEntry<?> entry)
      Sets a new source image to be displayed by this ImageDisplay.
      protected ImageDisplay.LoadImageRunnable setImage0​(IImageEntry<?> entry)  
      void setOsdText​(java.lang.String text)
      Sets the On-Screen-Display text.
      private void updateProcessedImage()  
      void updateVisibleRectangle()
      Update the visible rectangle (ensure zoom does not exceed specified values).
      void zoomBestFitOrOne()
      Make the current image either scale to fit inside this component, or show a portion of image (1:1), if the image size is larger than the component size.
      • Methods inherited from class javax.swing.JComponent

        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, getUI, 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
      • Methods inherited from class java.awt.Container

        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
      • Methods inherited from class java.awt.Component

        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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ImageDisplay

        public ImageDisplay()
        Constructs a new ImageDisplay with no image processor.
      • ImageDisplay

        public ImageDisplay​(ImageProcessor imageProcessor)
        Constructs a new ImageDisplay with a given image processor.
        Parameters:
        imageProcessor - image processor
        Since:
        17740
    • Method Detail

      • setImage

        public java.util.concurrent.Future<?> setImage​(IImageEntry<?> entry)
        Sets a new source image to be displayed by this ImageDisplay.
        Parameters:
        entry - new source image
        Returns:
        a Future representing pending completion of the image loading task
        Since:
        18246 (signature)
      • setEmptyText

        public void setEmptyText​(java.lang.String emptyText)
        Set the message displayed when there is no image to display. By default it display a simple No image
        Parameters:
        emptyText - the string to display
        Since:
        15333
      • setOsdText

        public void setOsdText​(java.lang.String text)
        Sets the On-Screen-Display text.
        Parameters:
        text - text to display on top of the image
      • paintComponent

        public void paintComponent​(java.awt.Graphics g)
        Overrides:
        paintComponent in class javax.swing.JComponent
      • paintErrorMessage

        private void paintErrorMessage​(java.awt.Graphics g,
                                       IImageEntry<?> imageEntry,
                                       IImageEntry<?> oldImageEntry,
                                       java.awt.image.BufferedImage bufferedImage,
                                       boolean currentErrorLoading,
                                       java.awt.Dimension size)
        Paint an error message
        Parameters:
        g - The graphics to paint on
        imageEntry - The current image entry
        oldImageEntry - The old image entry
        bufferedImage - The image being painted
        currentErrorLoading - If there was an error loading the image
        size - The size of the component
      • paintOsdText

        private void paintOsdText​(java.awt.Graphics g)
        Paint OSD text
        Parameters:
        g - The graphics to paint on
      • paintSelectedRect

        private void paintSelectedRect​(java.awt.Graphics g,
                                       java.awt.Rectangle target,
                                       ImageDisplay.VisRect visibleRectTemp,
                                       java.awt.Dimension size)
        Paint the selected rectangle
        Parameters:
        g - The graphics to paint on
        target - The target area (i.e., the selection)
        visibleRectTemp - The current visible rect
        size - The size of the component
      • getCenterImgCoord

        static java.awt.Point getCenterImgCoord​(java.awt.Rectangle visibleRect)
      • calculateDrawImageRectangle

        static ImageDisplay.VisRect calculateDrawImageRectangle​(ImageDisplay.VisRect visibleRect,
                                                                java.awt.Dimension compSize)
        calculateDrawImageRectangle
        Parameters:
        visibleRect - the part of the image that should be drawn (in image coordinates)
        compSize - the part of the component where the image should be drawn (in component coordinates)
        Returns:
        the part of compRect with the same width/height ratio as the image
      • calculateDrawImageRectangle

        static ImageDisplay.VisRect calculateDrawImageRectangle​(ImageDisplay.VisRect imgRect,
                                                                java.awt.Rectangle compRect)
        calculateDrawImageRectangle
        Parameters:
        imgRect - the part of the image that should be drawn (in image coordinates)
        compRect - the part of the component where the image should be drawn (in component coordinates)
        Returns:
        the part of compRect with the same width/height ratio as the image
      • zoomBestFitOrOne

        public void zoomBestFitOrOne()
        Make the current image either scale to fit inside this component, or show a portion of image (1:1), if the image size is larger than the component size.
      • getIImageViewer

        private IImageViewer getIImageViewer​(IImageEntry<?> entry)
        Get the image viewer for an entry
        Parameters:
        entry - The entry to get the viewer for. May be null.
        Returns:
        The new image viewer, may be null
      • getRotation

        public Vector3D getRotation​(IImageEntry<?> entry)
        Get the rotation in the image viewer for an entry
        Parameters:
        entry - The entry to get the rotation for. May be null.
        Returns:
        the current rotation in the image viewer, or null
        Since:
        18263
      • ensureMaxZoom

        private void ensureMaxZoom​(java.awt.Rectangle rectangle)
        Ensure that a rectangle isn't zoomed in too much
        Parameters:
        rectangle - The rectangle to get (typically the visible area)
      • updateVisibleRectangle

        public void updateVisibleRectangle()
        Update the visible rectangle (ensure zoom does not exceed specified values). Specifically only visible for IImageViewer implementations.
        Since:
        18246