001    /**
002     * Created by IntelliJ IDEA.
003     * User: Wei Wang
004     * Date: Nov 29, 2002
005     * Time: 12:57:16 AM
006     */
007    
008    package EVolve.util.painters;
009    
010    import java.awt.Color;
011    
012    import EVolve.visualization.AutoImage;
013    
014    public class CorrelationPainter extends Painter{
015        private int [][] value;
016    
017        public CorrelationPainter(int[][] value) {
018            this.value = value;
019        }
020    
021        public String getName() {
022            return "Correlation Painter";
023        }
024    
025        public void paint(AutoImage image, long x, long y, long z) {
026            for (int i = 0; i < value.length; i++) {
027                for (int j = 0; j < value[i].length; j++) {
028                    if (value[i][j] != 0) {
029                        //Color color = new Color((int)(value[i][j] * 255 / z), 0, (int)(255 - value[i][j] * 255 / z));
030                        image.setColor(i, j, Color.black);
031                    }
032                }
033            }
034        }
035    
036        public Object clone() {
037            CorrelationPainter o = (CorrelationPainter)super.clone();
038            o.value = new int[value.length][];
039            for (int i=0; i<value.length; i++) {
040                o.value[i] = new int[value[i].length];
041                for (int j=0; j<value[i].length; j++)
042                    o.value[i][j] = value[i][j];
043            }
044            return o;
045        }
046    }