Mercurial > hg > jslab
comparison src/samer/tools/ImageTrace.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bf79fb79ee13 |
---|---|
1 /* | |
2 * Copyright (c) 2000, Samer Abdallah, King's College London. | |
3 * All rights reserved. | |
4 * | |
5 * This software is provided AS iS and WITHOUT ANY WARRANTY; | |
6 * without even the implied warranty of MERCHANTABILITY or | |
7 * FITNESS FOR A PARTICULAR PURPOSE. | |
8 */ | |
9 | |
10 package samer.tools; | |
11 import java.awt.*; | |
12 import java.util.*; | |
13 | |
14 public class ImageTrace extends ImageTraceBase | |
15 { | |
16 private int x=0; | |
17 | |
18 public ImageTrace( ImageSourceBase i, Observable o) { super(i,o); } | |
19 | |
20 public void next() | |
21 { | |
22 ip.sendPixels(); | |
23 | |
24 // make room for next image | |
25 if (scroll) while (x+sx>width) { | |
26 graphics.copyArea(scrollStep,0,width-scrollStep,height,-scrollStep,0); | |
27 x-=scrollStep; | |
28 } | |
29 else if (x>=width) x=0; | |
30 | |
31 if (!sc) { | |
32 graphics.drawImage( img, x, 0, null); | |
33 } else { | |
34 if (stretch) { | |
35 graphics.drawImage( img, x, 0, sx, height, null); | |
36 } else { | |
37 graphics.drawImage( img, x, 0, sx, sy, null); | |
38 } | |
39 } | |
40 getToolkit().sync(); | |
41 | |
42 x+=sx; | |
43 } | |
44 | |
45 public Dimension getPreferredSize() { | |
46 return new Dimension(cx*256,cy*ip.getHeight()); | |
47 } | |
48 } |