samer@0: /* samer@0: * Copyright (c) 2000, Samer Abdallah, King's College London. samer@0: * All rights reserved. samer@0: * samer@0: * This software is provided AS iS and WITHOUT ANY WARRANTY; samer@0: * without even the implied warranty of MERCHANTABILITY or samer@0: * FITNESS FOR A PARTICULAR PURPOSE. samer@0: */ samer@0: samer@0: package samer.tools; samer@0: import java.awt.*; samer@0: import java.util.*; samer@0: samer@0: /** samer@0: Things to add: samer@0: UI for LinearMap used in MatrixImageSource samer@0: vertical and horizontal scaling: samer@0: cell size, samer@0: vertical stretch samer@0: vertical sweep version? samer@0: cooperate with MatrixImageSource for efficiency: samer@0: vertical strips rather than scan lines samer@0: samer@0: */ samer@0: samer@0: public class ImageVTrace extends ImageTraceBase samer@0: { samer@0: private int y=0; samer@0: samer@0: public ImageVTrace( ImageSourceBase i, Observable o) { super(i,o); } samer@0: samer@0: public void next() samer@0: { samer@0: ip.sendPixels(); samer@0: samer@0: // img is m by n samer@0: samer@0: if (!sc) { samer@0: graphics.drawImage( img, 0, y, null); samer@0: } else { samer@0: if (stretch) { samer@0: graphics.drawImage( img, 0, y, width, sy, null); samer@0: } else { samer@0: graphics.drawImage( img, 0, y, sx, sy, null); samer@0: } samer@0: } samer@0: samer@0: // Scroll DOWN samer@0: y-=sy; samer@0: if (scroll) while (y<0) { samer@0: graphics.copyArea(0,0,width,height-scrollStep-1,0,scrollStep); samer@0: y+=scrollStep; samer@0: } samer@0: else if (y<0) y=height-1; samer@0: samer@0: /* samer@0: // Scroll UP samer@0: y+=sy; samer@0: if (scroll) while (y>=height) { samer@0: graphics.copyArea(0,scrollStep,width,height-1,0,-scrollStep); samer@0: y-=scrollStep; samer@0: } samer@0: else if (y>=height) y=0; samer@0: */ samer@0: samer@0: } samer@0: samer@0: public Dimension getPreferredSize() { samer@0: return new Dimension(cx*ip.getWidth(),cy*256); samer@0: } samer@0: }