samer@0: /* samer@0: * MatrixImage.java 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.maths; samer@0: import samer.core.*; samer@0: import samer.tools.*; samer@0: import java.awt.Color; samer@0: samer@0: public class MatrixImage extends ImageViewer samer@0: { samer@0: Matrix M; samer@0: Node n; samer@0: samer@0: public MatrixImage( Matrix M) samer@0: { samer@0: // should make an intelligent choice of samer@0: // image source depending on shape of matrix samer@0: super(new MatrixImageSource( M, true),M.observable()); samer@0: this.n=Shell.env().node(); samer@0: this.M=M; samer@0: } samer@0: samer@0: public void scale() samer@0: { samer@0: double max, min, x; samer@0: int n=M.getRowDimension(); samer@0: int m=M.getColumnDimension(); samer@0: samer@0: min=max=M.get(0,0); samer@0: for (int i=0; imax) max=x; samer@0: if (x