diff src/samer/tools/ImageVTrace.java @ 0:bf79fb79ee13

Initial Mercurial check in.
author samer
date Tue, 17 Jan 2012 17:50:20 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/samer/tools/ImageVTrace.java	Tue Jan 17 17:50:20 2012 +0000
@@ -0,0 +1,71 @@
+/*
+ *	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.*;
+
+/**
+		Things to add:
+		UI for LinearMap used in MatrixImageSource
+		vertical and horizontal scaling:
+			cell size,
+			vertical stretch
+			vertical sweep version?
+			cooperate with MatrixImageSource for efficiency:
+			vertical strips rather than scan lines
+
+ */
+
+public class ImageVTrace extends ImageTraceBase
+{
+	private	int	y=0;
+
+	public ImageVTrace( ImageSourceBase i, Observable o) { super(i,o); }
+
+	public void next()
+	{ 
+		ip.sendPixels(); 
+
+		// img is m by n
+		
+		if (!sc) {
+			graphics.drawImage( img, 0, y, null);  
+		} else {
+			if (stretch) {
+				graphics.drawImage( img, 0, y, width, sy, null); 
+			} else {
+				graphics.drawImage( img, 0, y, sx, sy, null); 
+			}
+		}
+
+		// Scroll DOWN		
+		y-=sy;
+		if (scroll) while (y<0) { 
+			graphics.copyArea(0,0,width,height-scrollStep-1,0,scrollStep);
+			y+=scrollStep;
+		}
+		else if (y<0) y=height-1; 
+
+/*
+		// Scroll UP
+		y+=sy;
+		if (scroll) while (y>=height) { 
+			graphics.copyArea(0,scrollStep,width,height-1,0,-scrollStep);
+			y-=scrollStep;
+		}
+		else if (y>=height) y=0; 
+ */
+
+	}
+
+	public Dimension getPreferredSize() {
+		return new Dimension(cx*ip.getWidth(),cy*256);
+	}
+}