|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavalib.worldimages.AImage
javalib.worldimages.RasterImage
public class RasterImage
An image stored explicitly in raster form.
Field Summary | |
---|---|
static AffineTransform |
id
|
protected BufferedImage |
rendering
|
(package private) static Color |
transparent
|
Fields inherited from interface javalib.worldimages.WorldImage |
---|
LOOKS_SAME |
Constructor Summary | |
---|---|
protected |
RasterImage()
Default constructor so subclasses can start without a rendering and fill it in later. |
protected |
RasterImage(BufferedImage rendering)
Constructor that takes in an already-rendered image. |
Method Summary | |
---|---|
static WorldImage |
build(int width,
int height,
ImageBuilder b,
Object extra)
|
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. |
RasterImage |
frozen()
If it's already a RasterImage, that's good enough. |
int |
getBottom()
Produce the bottom of the bounding box. |
Color |
getPixelColor(int x,
int y)
Get the color of a specified pixel of an image. |
int |
getRight()
Produce the bottom of the bounding box. |
int |
hashCode()
Get a hash code for the WorldImage. |
(package private) static RasterImage |
make(BufferedImage rendering)
Pseudo-constructor. |
WorldImage |
map(ImageMap b,
Object extra)
Create a rectangular image pixel by pixel from an existing image. |
protected void |
renderIfNecessary()
make sure rendering isn't null |
boolean |
save(String filename)
Save a WorldImage to a .png file. |
protected void |
setRendering(BufferedImage rendering)
Setter so subclasses can fill in the rendering later. |
String |
toIndentedString(String indent)
Produce a String that represents this image, indented by the given indent . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final AffineTransform id
protected BufferedImage rendering
static final Color transparent
Constructor Detail |
---|
protected RasterImage()
protected RasterImage(BufferedImage rendering)
rendering
- Method Detail |
---|
public static WorldImage build(int width, int height, ImageBuilder b, Object extra)
public void draw(Graphics2D g)
WorldImage
Graphics2D
context.
g
- the provided Graphics2D
contextpublic boolean equals(Object other)
WorldImage
equals
in interface WorldImage
equals
in class AImage
other
- the object to compare with this
public RasterImage frozen()
frozen
in interface WorldImage
frozen
in class AImage
public int getBottom()
WorldImage
public Color getPixelColor(int x, int y)
WorldImage
getPixelColor
in interface WorldImage
getPixelColor
in class AImage
x
- the x coordinatey
- the y coordinate
public int getRight()
WorldImage
public int hashCode()
WorldImage
hashCode
in interface WorldImage
hashCode
in class Object
static RasterImage make(BufferedImage rendering)
rendering
- public WorldImage map(ImageMap b, Object extra)
WorldImage
map
in interface WorldImage
map
in class AImage
b
- an ImageMap encapsulating a function from Color to
Colorextra
- an arbitrary addtional argument to pass to the function
protected void renderIfNecessary()
public boolean save(String filename)
WorldImage
save
in interface WorldImage
save
in class AImage
protected void setRendering(BufferedImage rendering)
rendering
- public String toIndentedString(String indent)
WorldImage
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.
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 |