/** * ImageProcessor2.java * * This class consists of an EasyBufferedImage, plus some methods for * displaying various modifications of the image. Designed for the * example in CommandLineArgsTest.java. 2/9/05 */ import java.io.*; import java.awt.*; class ImageProcessor2 { private EasyBufferedImage image; public ImageProcessor2( String imageFileName ) throws IOException { image = EasyBufferedImage.createImage( imageFileName ); } public void show( String title, int x, int y ) { image.show( title, x, y ); } public void show( String title ) { image.show( title ); } public void removeGreenAndBlue() { int [] green = image.getPixels1D( EasyBufferedImage.GREEN ); int [] blue = image.getPixels1D( EasyBufferedImage.BLUE ); for( int k=0; k < green.length; k++ ) { green[k] = 0; blue[k] = 0; } image.setPixels( green, EasyBufferedImage.GREEN ); image.setPixels( blue, EasyBufferedImage.BLUE ); } public void removeRedAndBlue() { int [] red = image.getPixels1D( EasyBufferedImage.RED ); int [] blue = image.getPixels1D( EasyBufferedImage.BLUE ); for( int k=0; k < red.length; k++ ) { red[k] = 0; blue[k] = 0; } image.setPixels( red, EasyBufferedImage.RED ); image.setPixels( blue, EasyBufferedImage.BLUE ); } public boolean crop( int rowStart, int rowStop, int colStart, int colStop ) { System.out.println( "[crop is not yet implemented]" ); return true; } public void replaceRed( Color replacementColor ) { } public void replaceRed( EasyBufferedImage replacementImage ) { } public void negate() { } }