00001 package edu.stanford.hci.r3.actions.types.graphicscommands;
00002
00003 import java.awt.Graphics2D;
00004 import java.awt.geom.AffineTransform;
00005 import java.awt.image.BufferedImage;
00006 import java.io.File;
00007
00008 import edu.stanford.hci.r3.util.graphics.ImageCache;
00009
00020 public class DrawImageCommand implements GraphicsCommand {
00021
00022 private File file;
00023
00024 private int x;
00025
00026 private AffineTransform xform = new AffineTransform();
00027
00028 private int y;
00029
00033 public DrawImageCommand(File imageFile, int xVal, int yVal) {
00034 file = imageFile;
00035 x = xVal;
00036 y = yVal;
00037 }
00038
00045 public DrawImageCommand(File imageFile, int xVal, int yVal, AffineTransform transform) {
00046 this(imageFile, xVal, yVal);
00047 xform = transform;
00048 }
00049
00053 public void invoke(Graphics2D g2d) {
00054 BufferedImage image = ImageCache.loadBufferedImage(file);
00055 g2d.drawImage(image, xform, null );
00056 }
00057 }