JMU
logoPerspecTV.png
BillboardMarker


Background
Attributes:
Camera: This class must have a Camera attribute. This attribute must be initialized by the explicit value constructor.
Methods:
Explicit Value Constructor: This class must have an explicit value constructor with the following signature:
    /**
     * Explicit Value Constructor
     *
     * @param camera   The Camera to use when marking virtual billboards
     */
    public BillboardMarker(Camera camera)
  
The paste() Method: This class must have a method with the following signature:
    /**
     * "Paste" (i.e., place) an advertisment on a billboard
     *
     * @param image      The image containing a virtual billboard
     * @param ad         The image to place on the virtual billboard
     * @param index      The index of the virtual billboard
     * @return           A copy of the image with the billboard added
     */
    public Color[][] paste(Color[][] image, Color[][] ad, int index)
                           throws SizeMismatchException
   

This method must throw a SizeMismatchException if: the size of the ad differs from the size of the virtual billboard it is supposed to be pasted on. If the ad is null, this method must return a copy of the original image. Otherwise, it must return an appopriately modified copy of the image.

The position and size of the virtual billboard can be obtained from the Camera class. However it is important to observe that the virtual billboard may be partially obscured. Hence, this method must check each pixel in the virtual billboard to see if it is obscured.

The "idealized" color of the virtual billboard can be obtained from the Camera class. However, since the actual color may differ somewhat, this method must use the areSimilar() method in the ImageManipulator class.

Copyright 2011