Class ColorPickerPanel.ZoomPanel

    • Field Detail

      • m_Focus

        protected Point m_Focus
        the current location.
      • m_Scale

        protected double m_Scale
        the scale factor.
      • m_FocusSize

        protected int m_FocusSize
        the number of pixels to zoom.
    • Constructor Detail

      • ZoomPanel

        public ZoomPanel​(ColorPickerPanel owner)
        Initializes the panel.
        Parameters:
        owner - the panel this zoom is for
    • Method Detail

      • setFocus

        public void setFocus​(Point value)
        Sets the new location.
        Parameters:
        value - the location to zoom in
      • getFocus

        public Point getFocus()
        Returns the current location.
        Returns:
        the current location
      • setScale

        public void setScale​(double value)
        Sets the scale factor for the zoom.
        Parameters:
        value - the scale factor
      • getScale

        public double getScale()
        Returns the scale factor for the zoom.
        Returns:
        the scale factor
      • setFocusSize

        public void setFocusSize​(int value)
        Sets the size of the focus in pixels. Focus is centered.
        Parameters:
        value - the size in pixels
      • getFocusSize

        public int getFocusSize()
        Returns the size of the focus in pixels. Focus is centered.
        Returns:
        the size in pixels
      • updatePreferredSize

        protected void updatePreferredSize()
        Updates the preferred size.
      • createSubImage

        protected BufferedImage createSubImage()
        Creates the focus sub image.
        Returns:
        the subimage, null if owner does not have an image
      • calcFocusPosition

        protected int[] calcFocusPosition()
        Calculates the focus within the subimage.
        Returns:
        the x and y coordinates, null if no image available
      • paint

        public void paint​(Graphics g)
        Paints the image or just a white background.
        Overrides:
        paint in class JComponent
        Parameters:
        g - the graphics context