image
Class Scene

java.lang.Object
  extended by image.Image
      extended by image.Scene
Direct Known Subclasses:
EmptyScene

public abstract class Scene
extends Image

An abstract Class representing a Scene (a cropped Image). Images can be placed on a Scene at a specific location, resulting in a new Scene.

    new EmptyScene(48, 48).placeImage(new Triangle(32, "solid", "red"), 24, 24)

    new EmptyScene(48, 48).placeImage(new Triangle(64, "solid", "red"), 24, 24)

    new EmptyScene(48, 48).addLine(0, 0, 48, 48, "blue")

    new EmptyScene(48, 48).addLine(4, 24, 44, 24, "green")

    new EmptyScene(50, 50)
         .placeImage(new Overlay(new Circle(20, "outline", "black"),
                                 new Circle(20, "solid", "wheat")), 25, 25)
         .placeImage(new Circle(5, "solid", "lightblue"), 18, 20)
         .placeImage(new Rectangle(10, 3, "solid", "lightblue"), 33, 20)
         .placeImage(new Ellipse(20, 8, "solid", "red"), 25, 35)


Method Summary
 Scene addLine(double x, double y, double xx, double yy, java.lang.String color)
          Add a line to this Scene from (x,y) to (xx, yy)
 Scene addLine(int x, int y, int xx, int yy, java.lang.String color)
          Add a line to this Scene from (x,y) to (xx, yy)
 Scene addLine(Posn p1, Posn p2, java.lang.String color)
          Add a line to this Scene from the first Posn to the second
abstract  void paint(java.awt.Graphics g, int x, int y)
          Draw the scene into a Graphics
 Scene placeImage(Image i, double x, double y)
          Place another Image on top of this Scene at (x,y)
 Scene placeImage(Image i, int x, int y)
          Place another Image on top of this Scene at (x,y)
 Scene placeImage(Image i, Posn p)
          Place another Image on top of this Scene at the given Posn
 boolean toFile(java.lang.String name)
          Save this Scene to a File
 
Methods inherited from class image.Image
flipHorizontal, flipVertical, height, overlay, overlay, overlayxy, overlayxy, overlayxy, overlayxy, overlayxy, overlayxy, rasterize, rotate, rotate, toScene, toWhiteFile, toWhiteScene, width
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

paint

public abstract void paint(java.awt.Graphics g,
                           int x,
                           int y)
Draw the scene into a Graphics

Specified by:
paint in class Image

placeImage

public Scene placeImage(Image i,
                        double x,
                        double y)
Place another Image on top of this Scene at (x,y)


placeImage

public Scene placeImage(Image i,
                        int x,
                        int y)
Place another Image on top of this Scene at (x,y)


placeImage

public Scene placeImage(Image i,
                        Posn p)
Place another Image on top of this Scene at the given Posn


addLine

public Scene addLine(int x,
                     int y,
                     int xx,
                     int yy,
                     java.lang.String color)
Add a line to this Scene from (x,y) to (xx, yy)


addLine

public Scene addLine(double x,
                     double y,
                     double xx,
                     double yy,
                     java.lang.String color)
Add a line to this Scene from (x,y) to (xx, yy)


addLine

public Scene addLine(Posn p1,
                     Posn p2,
                     java.lang.String color)
Add a line to this Scene from the first Posn to the second


toFile

public boolean toFile(java.lang.String name)
Save this Scene to a File

Overrides:
toFile in class Image