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: public class ImageTrace extends ImageTraceBase samer@0: { samer@0: private int x=0; samer@0: samer@0: public ImageTrace( ImageSourceBase i, Observable o) { super(i,o); } samer@0: samer@0: public void next() samer@0: { samer@0: ip.sendPixels(); samer@0: samer@0: // make room for next image samer@0: if (scroll) while (x+sx>width) { samer@0: graphics.copyArea(scrollStep,0,width-scrollStep,height,-scrollStep,0); samer@0: x-=scrollStep; samer@0: } samer@0: else if (x>=width) x=0; samer@0: samer@0: if (!sc) { samer@0: graphics.drawImage( img, x, 0, null); samer@0: } else { samer@0: if (stretch) { samer@0: graphics.drawImage( img, x, 0, sx, height, null); samer@0: } else { samer@0: graphics.drawImage( img, x, 0, sx, sy, null); samer@0: } samer@0: } samer@0: getToolkit().sync(); samer@0: samer@0: x+=sx; samer@0: } samer@0: samer@0: public Dimension getPreferredSize() { samer@0: return new Dimension(cx*256,cy*ip.getHeight()); samer@0: } samer@0: }