Module org.jpo

Interface PictureControllerImage

All Known Implementing Classes:
ScalablePicture

public interface PictureControllerImage
The interface to define the capabilities a PictureController requires from the provider of the BufferedImage
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The expectation is that when this method is called on the implementing class that it will go off and scale the image.
    int
    return the height of the original image or Zero if there is none
    int
    return the width of the original image or Zero if there is none
    Must return the scaled image for drawing.
    double
    The implementing image provider needs to return the scale factor to which the image is scaled
    void
    setScaleFactor(double newFactor)
    Set the scale factor to the new desired value.
    void
    invoke this method to tell the scale process to figure out the scale factor so that the image fits either by height or by width into the indicated dimension.
  • Method Details

    • getScaleFactor

      double getScaleFactor()
      The implementing image provider needs to return the scale factor to which the image is scaled
      Returns:
      the scale factor
    • getOriginalWidth

      int getOriginalWidth()
      return the width of the original image or Zero if there is none
      Returns:
      the original width of the image
    • getOriginalHeight

      int getOriginalHeight()
      return the height of the original image or Zero if there is none
      Returns:
      the original height of the image
    • setScaleFactor

      void setScaleFactor(double newFactor)
      Set the scale factor to the new desired value. The scale factor is a multiplier by which the original picture needs to be multiplied to get the size of the picture on the screen. The image should only be scaled when createScaledPictureInThread(int) is called.

      Example: Original is 3000 x 2000 --> Scale Factor 0.10 --> Target Picture is 300 x 200

      Parameters:
      newFactor - new facture
    • createScaledPictureInThread

      void createScaledPictureInThread(int priority)
      The expectation is that when this method is called on the implementing class that it will go off and scale the image. The implementing classes need to ensure that the PictureController is requested to repaint itself when the image is ready.
      Parameters:
      priority - The Thread priority
    • setScaleSize

      void setScaleSize(Dimension newSize)
      invoke this method to tell the scale process to figure out the scale factor so that the image fits either by height or by width into the indicated dimension.
      Parameters:
      newSize - new size
    • getScaledPicture

      BufferedImage getScaledPicture()
      Must return the scaled image for drawing.
      Returns:
      the scaled image