public class LowpassMapping extends PixelMapping { int ccx=0,ccy=0; boolean startAgain; boolean lastPixel = false; float radius = 0; float amount = 0; // touchest the inside of a circle at the centre of the picture public LowpassMapping(ComplexImage ci, PixelMapping ne){super(ci,ne);} public void setOrigin(int x,int y) { startAgain=true; ox = x; oy = y; if (next!=null) next.setOrigin(ox,oy); } public boolean morePixels() { if (!lastPixel) return true; if (next!=null) return next.morePixels(); return false; } public PixelDesc nextPixel() { if (next == null) { System.out.println("Should never be called"); } else { if (!startAgain) { boolean ex = false; ccx++; while((!ex) && (ccyradius) ex=true; else ccx++; } if (!ex) { ccy++; ccx = 0; } } if (ex) { // System.out.println("returning : "+ccx+" "+ccy); return new PixelDesc(null,ccx,ccy,amount); } else if (next.morePixels()) { System.out.println("asking for another pixel"); startAgain=true; } else { System.out.println("end of all of it"); lastPixel = true; return null; } } // fall through if (startAgain) { startAgain = false; PixelDesc pd = next.nextPixel(); amount = pd.amount; radius = (float)Math.sqrt((pd.x-complexImage.w/2)*(pd.x-complexImage.w/2)+(pd.y-complexImage.h/2)*(pd.y-complexImage.h/2)); // now draw an ellipse from the center to that point lastPixel = false; ccx=0;ccy=0; boolean ex = false; while((!ex) && (ccyradius) ex=true; else ccx++; } if (!ex) ccy++; } if (ex) return new PixelDesc(null,ccx,ccy,pd.amount); if (ccy==complexImage.h) lastPixel=true; return null; } } return(null); } }