| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavalib.worldimages.AImage
javalib.worldimages.LinearImage
public class LinearImage
An image which is a translation of another existing image.
| Field Summary | 
|---|
| Fields inherited from interface javalib.worldimages.WorldImage | 
|---|
| LOOKS_SAME | 
| Constructor Summary | |
|---|---|
| LinearImage(AffineTransform transform,
            WorldImage base)Constructor for objects of class LinearImage | |
| Method Summary | |
|---|---|
|  void | draw(Graphics2D g)Draw this image in the provided Graphics2Dcontext. | 
|  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 | 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. | 
|  Posn | getTranslation()Getter for the translation field. | 
|  int | getWidth()Retrieve the width of the image, in pixels. | 
|  int | getX()Getter for the x coordinate of the translation field (just for brevity). | 
|  int | getY()Getter for the y coordinate of the translation field (just for brevity). | 
| (package private) static WorldImage | make(AffineTransform transform,
     WorldImage base)Pseudo-constructor for objects of class LinearImage. | 
|  String | toIndentedString(String indent)Produce a Stringthat represents this image, indented by the givenindent. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface javalib.worldimages.WorldImage | 
|---|
| hashCode | 
| Constructor Detail | 
|---|
LinearImage(AffineTransform transform,
            WorldImage base)
base - the image to transformtransform - what to do to it| Method Detail | 
|---|
public void draw(Graphics2D g)
WorldImageGraphics2D context.
g - the provided Graphics2D contextpublic boolean equals(Object other)
WorldImage
equals in interface WorldImageequals in class AImageother - the object to compare with this
public int getBottom()
WorldImage
public int getHeight()
AImage
getHeight in interface WorldImagegetHeight in class AImagepublic int getLeft()
AImage
getLeft in interface WorldImagegetLeft in class AImagepublic int getRight()
WorldImage
public int getTop()
AImage
getTop in interface WorldImagegetTop in class AImagepublic Posn getTranslation()
public int getWidth()
AImage
getWidth in interface WorldImagegetWidth in class AImagepublic int getX()
public int getY()
static WorldImage make(AffineTransform transform,
                       WorldImage base)
The main purpose of the pseudo-constructor is to collapse multiple successive linear transforms into one, so we don't get a bunch of deeply-nested LinearImages.
This isn't just an optimization: it affects the calculation of the bounding box. If two or more LinearImages are nested, the bounding box of the outer one is calculated from the four corners of the bounding box of the inner one, which are in turn calculated from the four corners of the bounding box of the inner one's base. The visible effect of this is that when you repeatedly rotate a single image, the accumulated errors cause it to spiral out of control. With LinearImages collapsed, the same could still happen (e.g. if there were a Crop or an Overlay between each pair of LinearImages), but it's much less likely.
base - the image to transformtransform - what to do to itpublic String toIndentedString(String indent)
WorldImageString 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.
indent - the given prefix representing the desired indentation
String representation of this image| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||