racket/collects/htdch/graphics/Image.djava
2006-07-06 22:30:02 +00:00

63 lines
1.5 KiB
Plaintext

package graphics;
import scheme.lib.htdp.image;
import scheme.lib.graphics.graphics;
import scheme.lib.htdch.graphics.rename;
public class Image {
dynamic theImage;
Image( dynamic i ) {
this.theImage = i;
}
dynamic getBitmap() {
return theImage.getBitmap();
}
public Image movePinhole( Posn p ) {
return new Image( image.movePinhole(theImage, p.x, p.y) );
}
public Image putPinhole( Posn p ) {
return new Image( image.putPinhole(theImage, p.x, p.y) );
}
public Image overlay( Image i ) {
return new Image( image.overlay( theImage, i.theImage ) );
}
public Image overlayXY( Image i, Posn p) {
return new Image( rename.overlayXY( theImage, p.x, p.y, i.theImage));
}
public Posn getPinhole() {
return new Posn( image.pinholeX(theImage),image.pinholeY(theImage) );
}
public boolean inside( Image isInside ) {
return image.imageInsideP( theImage, isInside.theImage );
}
public Posn find( Image inside ) {
dynamic position = image.findImage(theImage, inside.theImage );
return new Posn( graphics.posnX(position), graphics.posnY(position) );
}
public Image addLine(Posn start, Posn end, Color c) {
return new Image(image.addLine(theImage, start.x, start.y, end.x, end.y, c.toString()));
}
public int width() {
return image.imageWidth( theImage );
}
public int height() {
return image.imageHeight( theImage );
}
public boolean equals(Object o) {
return (o instanceof Image) && rename.imageEqP(theImage,((Image) o).theImage);
}
}