public class MotherImageMapping extends ComplexImageMapping { // does it all. public float lowpoint=0,highpoint=255; public float lowest=0,highest=255; public boolean logrithmic; public boolean phase; public boolean mag; public boolean automatic; public boolean tiezero; int[] histo = new int[256]; public void setColour(boolean c) { } public void sample(Complex a) { if (automatic) { float m; if (mag) m = a.getMag(); else m = a.r; if (logrithmic) { if (m!=0) m = (float)Math.log(Math.abs(m)); else m=-6; if (m<-6) m = -6; } if (mhighest) highest = m; } } public int perform(Complex a) { float m; if (mag) m = a.getMag(); else m = a.r; if (logrithmic) { if (m!=0) m = (float)Math.log(Math.abs(m)); else m=-6; if (m<-6) m = -6; } int r = (int)(255*(m-lowest)/(highest-lowest)); if (r<0) r = 0; if (r>255) r = 255; histo[r]++; if (mhighpoint) m = highpoint; int red = (int)(255*(m-lowpoint)/(highpoint-lowpoint)); if (phase) { float p = (float)(a.getPhase()/(2*Math.PI)); return( (255 << 24) | java.awt.Color.HSBtoRGB(p,(float)0.2,(float)red/255) ); } else { return (255<<24) | red <<16 | red << 8 | red; } } public boolean needsPreRun() { return automatic; } public void initialise() { if (automatic) { highest=-10000000; lowest =10000000; for(int n=0;n<256;n++) histo[n] = 0; } } public void complete() { automatic = false; } public int backMap(float z) { if (!logrithmic) { return (int)(((highpoint-lowpoint)*z)+lowpoint); } else { return 0; // not working yet; } } }