Module hw06

Interface IATImage

All Superinterfaces:
IDimension

public interface IATImage extends IDimension
An interface that represents an affine transform drawable image object. This interface is designed to hide the UI-dependent parts of various processes such as getting the width and height of the image and drawing the image onto a Graphics object by wrapping an Image object with Component that is used to control it. This enables the user of an IATImage object to be more decoupled from the view than would be possible if Image objects were used directly.
Author:
swong
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static IATImage
    An error image that is just a black square that will transform in the same way as an image.
    Factory object that will instantiate an IATImage given an Image and a Component (the ImageObserver).
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Draw the image onto the given Graphics object using the given AffineTransform.

    Methods inherited from interface provided.utils.displayModel.IDimension

    getHeight, getWidth
  • Field Details

    • FACTORY

      static final BiFunction<Image,​Component,​IATImage> FACTORY
      Factory object that will instantiate an IATImage given an Image and a Component (the ImageObserver). The Component should be the canvas object upon which the balls are displayed. The factory's apply() method will block until the given image has fully loaded. If the loading is interrupted, then an IATImage.ERROR object will be returned. Usage: Use this factory to instantiate another factory ( Function<Image, IATImage> ) where the imageObs value is curried into the IATImage apply(Image image) method of the new factory. This will create a usable factory where the imageObs Component object is no longer visible.
    • ERROR

      static final IATImage ERROR
      An error image that is just a black square that will transform in the same way as an image.
  • Method Details

    • draw

      void draw(Graphics g, AffineTransform at)
      Draw the image onto the given Graphics object using the given AffineTransform.
      Parameters:
      g - The Graphics object to draw on. It is assumed that this is actually a Graphics2D object.
      at - The net affine transform that will transform the image (upper left hand origin) to its proper location on the drawing canvas.