javalib.worldimages
Class RectangularImage

java.lang.Object
  extended by javalib.worldimages.AImage
      extended by javalib.worldimages.ColoredImage
          extended by javalib.worldimages.RectangularImage
All Implemented Interfaces:
Drawable, WorldImage, tester.ISame<WorldImage>
Direct Known Subclasses:
EllipseImage, RectangleImage

abstract class RectangularImage
extends ColoredImage

An image that directly stores its own width and height.

Version:
Dec. 2, 2012
Author:
Stephen Bloch

Field Summary
 
Fields inherited from class javalib.worldimages.ColoredImage
defaultColor
 
Fields inherited from interface javalib.worldimages.WorldImage
LOOKS_SAME
 
Constructor Summary
RectangularImage(int width, int height, Color color, Mode mode)
          The full constructor
RectangularImage(int width, int height, IColor color, Mode mode)
           
 
Method Summary
 boolean equals(Object other)
          Is this the same as another WorldImage, as expression trees? Define this at every level that has instance variables.
 int getBottom()
          Produce the bottom of the bounding box.
 int getRight()
          Produce the bottom of the bounding box.
 int hashCode()
          Get a hash code for the WorldImage.
(package private) abstract  RectangularImage replaceDimensions(int width, int height)
          Functional setter for width and height.
(package private)  RectangularImage replaceHeight(int height)
          Functional setter for height.
(package private)  RectangularImage replaceWidth(int width)
          Functional setter for width.
 
Methods inherited from class javalib.worldimages.ColoredImage
getColor, getMode, replaceColor, replaceColor, replaceMode
 
Methods inherited from class javalib.worldimages.AImage
above, aboveCentered, beside, besideCentered, build, build, centerMoved, centerMoved, cornerString, cropped, frozen, getCenter, getHeight, getLeft, getPixelColor, getTop, getWidth, 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
 
Methods inherited from interface javalib.worldimages.WorldImage
draw, toIndentedString
 

Constructor Detail

RectangularImage

RectangularImage(int width,
                 int height,
                 Color color,
                 Mode mode)
The full constructor

Parameters:
width -
height -
color -

RectangularImage

RectangularImage(int width,
                 int height,
                 IColor color,
                 Mode mode)
Method Detail

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 ColoredImage
Parameters:
other - the object to compare with this
Returns:
true iff the images are isomorphic expression trees, with equal fields.

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

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

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 ColoredImage

replaceDimensions

abstract RectangularImage replaceDimensions(int width,
                                            int height)
Functional setter for width and height.

Parameters:
width -
height -
Returns:
a new image just like this one but with different dimensions.

replaceHeight

RectangularImage replaceHeight(int height)
Functional setter for height.

Parameters:
height -
Returns:
a new image just like this one but with different height.

replaceWidth

RectangularImage replaceWidth(int width)
Functional setter for width.

Parameters:
width -
Returns:
a new image just like this one but with different width.