javalib.worldimages
Class OverlayImage

java.lang.Object
  extended by javalib.worldimages.AImage
      extended by javalib.worldimages.OverlayImage
All Implemented Interfaces:
Drawable, WorldImage, tester.ISame<WorldImage>

public class OverlayImage
extends AImage

The overlay of two images.

Version:
Dec. 5, 2012
Author:
Stephen Bloch

Field Summary
 
Fields inherited from interface javalib.worldimages.WorldImage
LOOKS_SAME
 
Method Summary
 void draw(Graphics2D g)
          Draw this image in the provided Graphics2D context.
 boolean equals(Object other)
          Is this the same as another WorldImage, as expression trees? Define this at every level that has instance variables.
 WorldImage getBack()
          Getter for the background part of an Overlay.
 int getBottom()
          Produce the bottom of the bounding box.
 WorldImage getFront()
          Getter for the foreground part of an Overlay.
 int getHeight()
          Retrieve the height of the image, in pixels.
 int getLeft()
          Getter for the left edge of the bounding box.
 int getRight()
          Produce the bottom of the bounding box.
 int getTop()
          Getter for the top of the bounding box.
 int getWidth()
          Retrieve the width of the image, in pixels.
 int hashCode()
          Get a hash code for the WorldImage.
(package private) static OverlayImage make(WorldImage back, WorldImage front)
          Pseudo-constructor
 String toIndentedString(String indent)
          Produce a String that represents this image, indented by the given indent.
 
Methods inherited from class javalib.worldimages.AImage
above, aboveCentered, beside, besideCentered, build, build, centerMoved, centerMoved, cornerString, cropped, frozen, getCenter, getPixelColor, isApplet, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCircle, makeCircle, makeCircle, makeCircle, makeCircle, makeCircle, makeEllipse, makeEllipse, makeEllipse, makeEllipse, makeEllipse, makeEllipse, makeFromFile, makeFromURL, makeImage, makeLine, makeLine, makeLine, makePolygon, makePolygon, makePolygon, makePolygon, makePolygon, makePolygon, makeRectangle, makeRectangle, makeRectangle, makeRectangle, makeRectangle, makeRectangle, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, map, map, moved, moved, normalized, overlay, overlayCentered, overlayImages, overlayXY, place, rotate, rotated, rotated, rotatedAround, rotatedAround, rotatedInPlace, rotatedInPlace, same, sameClass, save, scaled, scaled, show, toString, xReflected, yReflected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

draw

public void draw(Graphics2D g)
Description copied from interface: WorldImage
Draw this image in the provided Graphics2D context.

Parameters:
g - the provided Graphics2D context

equals

public boolean equals(Object other)
Description copied from interface: WorldImage
Is this the same as another WorldImage, as expression trees? Define this at every level that has instance variables.

Specified by:
equals in interface WorldImage
Overrides:
equals in class AImage
Parameters:
other - the object to compare with this
Returns:
true iff the images are isomorphic expression trees, with equal fields.

getBack

public WorldImage getBack()
Getter for the background part of an Overlay.

Returns:
the background image

getBottom

public int getBottom()
Description copied from interface: WorldImage
Produce the bottom of the bounding box.

Returns:
the y coordinate of the bottom of the bounding box

getFront

public WorldImage getFront()
Getter for the foreground part of an Overlay.

Returns:
the foreground image

getHeight

public int getHeight()
Description copied from class: AImage
Retrieve the height of the image, in pixels.

Specified by:
getHeight in interface WorldImage
Overrides:
getHeight in class AImage
Returns:
an int

getLeft

public int getLeft()
Description copied from class: AImage
Getter for the left edge of the bounding box.

Specified by:
getLeft in interface WorldImage
Overrides:
getLeft in class AImage
Returns:
the minimum x coordinate of the image

getRight

public int getRight()
Description copied from interface: WorldImage
Produce the bottom of the bounding box.

Returns:
the x coordinate of the right edge of the bounding box

getTop

public int getTop()
Description copied from class: AImage
Getter for the top of the bounding box.

Specified by:
getTop in interface WorldImage
Overrides:
getTop in class AImage
Returns:
the minimum y coordinate of the image

getWidth

public int getWidth()
Description copied from class: AImage
Retrieve the width of the image, in pixels.

Specified by:
getWidth in interface WorldImage
Overrides:
getWidth in class AImage
Returns:
an int

hashCode

public int hashCode()
Description copied from interface: WorldImage
Get a hash code for the WorldImage. Needs to agree with equals(). In our case, "equals" means they're the same as expression trees.

Specified by:
hashCode in interface WorldImage
Overrides:
hashCode in class Object

make

static OverlayImage make(WorldImage back,
                         WorldImage front)
Pseudo-constructor

Parameters:
back -
front -

toIndentedString

public String toIndentedString(String indent)
Description copied from interface: WorldImage
Produce a String that represents this image, indented by the given indent.

Define this in all concrete subclasses.

Convention: The result of toIndentedString() will neither begin nor end with a newline; the specified indent will immediately follow each internal newline.

Parameters:
indent - the given prefix representing the desired indentation
Returns:
the String representation of this image