Mercurial > hg > jslab
view src/samer/tools/ImageTrace.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
line wrap: on
line source
/* * Copyright (c) 2000, Samer Abdallah, King's College London. * All rights reserved. * * This software is provided AS iS and WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. */ package samer.tools; import java.awt.*; import java.util.*; public class ImageTrace extends ImageTraceBase { private int x=0; public ImageTrace( ImageSourceBase i, Observable o) { super(i,o); } public void next() { ip.sendPixels(); // make room for next image if (scroll) while (x+sx>width) { graphics.copyArea(scrollStep,0,width-scrollStep,height,-scrollStep,0); x-=scrollStep; } else if (x>=width) x=0; if (!sc) { graphics.drawImage( img, x, 0, null); } else { if (stretch) { graphics.drawImage( img, x, 0, sx, height, null); } else { graphics.drawImage( img, x, 0, sx, sy, null); } } getToolkit().sync(); x+=sx; } public Dimension getPreferredSize() { return new Dimension(cx*256,cy*ip.getHeight()); } }