%ffp Category: "AmphiSoft" Title: "Max Demo" Author: "Ilyich the Toad \n(ilyich@snark.rinet.ru; ilyich@cacr.ioc.ac.ru)" Copyright: "© 1999 by Ilyich the Toad" Description: "A wise optimization of Maximum function" "Contact ilyich@cacr.ioc.ac.ru, ilyich@snark.rinet.ru, bufo@chat.ru" Version: "0.3" Dialog:color=silver ctl[0]:"Width",range=(1,100),val=4,pagesize=4,linesize=1, pos=(266, 10), size=(90,9), fontcolor=black ctl[1]:"Height",range=(1,100),val=4,pagesize=4,linesize=1, pos=(266, 22), size=(90,9), fontcolor=black ctl[5]:CHECKBOX, "Square", val=1, pos=(221,36), size=(60,10), fontcolor=black ctl[6]:CHECKBOX, "Across Edges", val=0, pos=(300,36), size=(70,10), fontcolor=black ctl[21]:GROUPBOX(group), "Kernel", pos=(215,0),size=(170,48),fontcolor=navyblue,color=silver ForEveryTile: { int kernelwidth, kernelheight, xleft, xright, ytop, ybottom; int max, oldmax, temp, oldtemp; int i, no, total=Z*(y_end-y_start)+Z*(x_end-x_start); bool square=ctl(5), wrap=ctl(6); if (square) {enableCtl(1,0); setCtlText(0, "Radius"); setCtlText(21, "Kernel");} else {enableCtl(1,3); setCtlText(21, "Kernel Radii"); setCtlText(0, "Horizontal"); setCtlText(1, "Vertical"); }; if (square) {setCtlRange(0,1,scaleFactor*X/8); setCtlRange(1,1,scaleFactor*Y/8);} else {setCtlRange(0,1,scaleFactor*max(X,Y)/8);} kernelwidth=max((2*ctl(0)+scaleFactor)/scaleFactor, 1); // bypass for tiny preview if (square) {kernelheight=kernelwidth;} else kernelheight=max((2*ctl(1)+scaleFactor)/scaleFactor, 1); // bypass for tiny preview no=0; if (x_start(X-kernelwidth)) {xright=x_end+kernelwidth;} else {xright=x_end;}; if (y_start(Y-kernelheight)) {ybottom=y_end+kernelheight;} else {ybottom=y_end;}; for (z= 0; z < Z; z++) { for (y=max(0,y_start-kernelheight); y < min(Y,y_end+kernelheight); y++) { if(updateProgress(no,total)) break; no++; max=0; oldmax=0; for (i=0; i=oldmax) {max=temp;} else { if (wrap) {oldtemp=src((x-1-kernelwidth/2+X)%X,y,z);} else {oldtemp=src(x-1-kernelwidth/2,y,z);}; if (oldtemp=oldmax) {max=temp;} else { if (wrap) {oldtemp=tget(x,(y-1-kernelheight/2+Y)%Y,z);} else {oldtemp=tget(x,y-1-kernelheight/2,z);}; if (oldtemp