%FFP Category :"Alf's New Toys" Title :"Movin'" Copyright :"Copyright © 2000 Alfredo Luis Mateus.\r\n" "" Author :"almateus@globalsite.com.br" Filename :"movin.8bf" Description:"First test based on jalusi demo (Alex Hunter + Martin VDLee)." Version :"1.0" Dialog :gradient=(gray,white,v) // Control definitions: ctl(0):"Anim. Speed:",val=6, range=(1,X/4),pos=(224,100) ctl(1):"Moving:",val=0, range=(0,min(X/2,Y/2)) ctl(3):OWNERDRAW(staticedge),size=(20,20),pos=(200,10), range=(0, 0xffffff), color=bgColor,val=bgColor, action=preview, tooltip="Choose background color" //clicking an OWNERDRAW control sets val=1, //so we need to save the color value in some //dummy controls... ctl(5):OWNERDRAW,invisible,disabled, range=(0, 0xffffff),val=bgColor onCtl(n):{ int color; if ((n == 3 || n == 4) && e == FME_CLICKED) { //Info("ctl(%d) = %6.6x", n+2, ctl(n+2)); color = chooseColor(ctl(n+2), (n == 4) ? "Choose foreground color:" : "Choose background color:"); if (color != -1) { setCtlColor(n, color); setCtlVal(n+2, color); } } return false; } //OnCtl ForEveryPixel: { int quad; //check if it is in the first quadrant if (x<=X/2&&yX/2&&y=Y/2) quad = 3; else quad = 4; if (quad==1) { if(x<=X/2-ctl(1)&&yX/2+ctl(1)&&y<=Y/2-ctl(1)) { R = src(x-ctl(1),y+ctl(1),0); G = src(x-ctl(1),y+ctl(1),1); B = src(x-ctl(1),y+ctl(1),2); A = src(x-ctl(1),y+ctl(1),3); } else { R = Rval(ctl(5)); G = Gval(ctl(5)); B = Bval(ctl(5)); A = 0; } } else { //check if it is in the third quadrant if (quad==3) { if(x=Y/2+ctl(1)) { R = src(x+ctl(1),y+ctl(1),0); G = src(x+ctl(1),y+ctl(1),1); B = src(x+ctl(1),y+ctl(1),2); A = src(x+ctl(1),y+ctl(1),3); } else { R = Rval(ctl(5)); G = Gval(ctl(5)); B = Bval(ctl(5)); A = 0; } } else { //check if it is in the fourth quadrant if (quad==4) { if(x>=X/2+ctl(1)&&y>=Y/2+ctl(1)) { R = src(x+ctl(1),y-ctl(1),0); G = src(x+ctl(1),y-ctl(1),1); B = src(x+ctl(1),y-ctl(1),2); A = src(x+ctl(1),y-ctl(1),3); } else { R = Rval(ctl(5)); G = Gval(ctl(5)); B = Bval(ctl(5)); A = 0; } } else { R = r; G = g; B = b; A = a; } } //ForEveryPixel } }} /////////// Demo Mode Implementation ///////////// ctl(40):CHECKBOX(pushlike),"Animate",size=(40,14),pos=(224,80) ForEveryTile:{ int i; bool aborting = 0; if (ctl(40)) { //Run the demo //Save user's current control settings, //and set values for demo... k1 = setCtlVal(1, 0); //Going out for (i=0; i <=min(X/2,Y/2); i+=ctl(0)) { setCtlVal(1, i); if (aborting = doForEveryRow()) break; updatePreview(-99); } //Going in if (!aborting) for (i=min(X/2,Y/2); i >=0; i-=ctl(0)) { setCtlVal(1, i); if (doForEveryRow()) break; updatePreview(-99); } //Restore the user's settings setCtlVal(1, k1); updateProgress(0, 0); setCtlVal(40, 0); //reset 1-shot return false; //doForEveryRow() } else { // just run the filter once. return false; //doForEveryRow() } } //ForEveryTile