Home | Download | Documents | Tips & Tutorials | Code Library | Help / User Group | Order

 

Alf's Pattern Examples #1


Wavy Patterns | Zig Zag Patterns | Line Patterns 

1. Wavy Patterns

From: Alfredo Mateus <almateus@globalsite.com.br>
To: fm@lists.best.com
Subject: Re: FM: Beta Release 0.4.9
Date: Saturday, March 06, 1999 10:26 AM

Alex Hunter wrote:
>
Hi Alex, I installed 0.49 and already played with it. Check the results,
maybe I am really getting the hang of it, didn't need an example for
this...
There are 9 filters and 4 apply modes for now. Besides the wavy patterns
I have the corresponding straight ones, the same with gradients (like my
blinds filter) and some other ideas, like triangular waves (zig-zag) and
squares waves on the planing. My idea is to use another combo to pick
through the different sets.

Opinions are welcome. The picture for the background is going to be sent
to Alex only so he can post it on his page. It is simply several little
squares with the pattern each radio button selects.

Alf


1.1 Step One

Click on the following image to download patternwav.zip, then unzip the bitmap file (patternwav.bmp) into a directory of your choice.

Click to download the zipped BMP file (patternwav.zip -- 26KB) 


1.2 Step Two

Copy and paste the following FF+ code into the FM source window.  Save the source code as file patterns.ffp in the same directory where you unzipped the bitmap file above (patternwav.bmp), so that FM will know where to find the dialog background image.  Then Compile and run the filter!

(Note from Alex: I made one change to the following code.  I changed the image mode in the Dialog key from 'tiled' to 'stretched' so that it will work correctly on systems with a non-default system font size. Depending on your video driver, the initial display of the "stretched" image may take some time; but this will not affect the display rendering time on the final "stand-alone" result.  Also, you will get some weird effects when entering Edit Mode or Advanced Edit Mode, since the image will be stretched to span the size of the entire dialog box, including the source edit window, etc.  But the background image should be sized correctly when you exit Edit Mode.)

%FFP

Category   :"Alf's Power Toys"
Title      :"Patterns"
Copyright  :"Copyright 1997 by almateus@globalsite.com.br"
Author     :"Alfredo Mateus"
Filename   :"Pattern.8bf"
Description:"Created based on multi-filter example by Alex Hunter"
Version    :"1.0"

Dialog : image="patternwav.bmp",stretched

// Control definitions:

ctl(0):"",val=50,range=(1,100),pos=(170,5),size=(80,6)
ctl(1):"",val=50,range=(1,100),pos=(170,14),size=(80,6)
ctl(2):"",val=4,range=(1,16),pos=(280,5),size=(80,6)

ctl(51):RADIOBUTTON(GROUP,TABSTOP),"",pos=(180,30),size=(40,8),action=preview,val=1
ctl(52):RADIOBUTTON,"",pos=(180,60),size=(50,8),action=preview
ctl(53):RADIOBUTTON,"",pos=(180,90),size=(50,8),action=preview
ctl(54):RADIOBUTTON,"",pos=(240,90),size=(50,8),action=preview
ctl(55):RADIOBUTTON,"",pos=(240,30),size=(40,8),action=preview
ctl(56):RADIOBUTTON,"",pos=(240,60),size=(40,8),action=preview
ctl(57):RADIOBUTTON,"",pos=(290,30),size=(50,8),action=preview
ctl(58):RADIOBUTTON,"",pos=(290,60),size=(50,8),action=preview
ctl(59):RADIOBUTTON,"",pos=(290,90),size=(50,8),action=preview

ctl(60):GROUPBOX(GROUP),pos=(176,20),size=(158,98)
 

ctl(10) : COMBOBOX(dropdown),
pos=(335,30),size=(50,82),text="Normal\nMultiply\nScreen\nDifference",action=preview
 

ForEveryTile:{
  if (doingProxy) {
    int choice, previousChoice;
    // Determine the current radio button selection,
    // save it in the GROUPBOX, and see if it changed...
    if (ctl(51)) choice = 1;
    else if (ctl(52)) choice = 2;
    else if (ctl(53)) choice = 3;
    else if (ctl(54)) choice = 4;
    else if (ctl(55)) choice = 5;
    else if (ctl(56)) choice = 6;
    else if (ctl(57)) choice = 7;
    else if (ctl(58)) choice = 8;
    else choice = 9;

    previousChoice = setCtlVal(60, choice);

    if (choice != previousChoice) {
      // Alter the User Interface as necessary
      if (ctl(51)) {
        // Vertical
        setDialogText("Vertical");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(52)) {
        // Horizontal
        setDialogText("Horizontal");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(53)) {
        // Diagonal 1
        setDialogText("Diagonal 1");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(54)) {
        // Diagonal 2
        setDialogText("Diagonal 2");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(55)) {
        // Rings
        setDialogText("Rings");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(56)) {
        // Radial
        setDialogText("Radial");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(57)) {
        // Checkers
        setDialogText("Checkers");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(58)) {
        // Diag. Checkers
        setDialogText("Diagonal Checkers");
        setCtlText(0, ""); setCtlVal(0,32);setCtlVal(2,8);setCtlVal(10,0);
      }
      else {
        // Dartboard
        setDialogText("Dartboard");
        setCtlText(0, ""); setCtlVal(10,0);
      }
    }//if choice changed
  }//if doingProxy
  false; //doForEveryRow
} //ForEveryTile

//////////////////// Vertical ////////////////////

R: ctl(51) ? put(scl(y*val(0,1,100),0,Y,0,255),1),
             put(scl(x*val(1,1,100),0,X,0,255),2),
             put(scl(sin(get(2)+sin(get(1))/ctl(2)),-512,512,-Y,Y),5),
             put(get(5)>0?0:255,11),
 
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
             : R

G: ctl(51) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11):
G

B: ctl(51) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11):
B

A:a

//////////////////// Horizontal ////////////////////
R: ctl(52) ? put(scl(y*val(0,1,64),0,Y,0,255),1),
             put(scl(x*val(1,1,64),0,X,0,255),2),
             put(scl(sin(get(1)+sin(get(2))/ctl(2)),-512,512,-Y,Y),6),
             put(get(6)>0?0:255,11),
 
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
             : R
 
G: ctl(52) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
: G

B: ctl(52) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
: B

A:a

//////////////////// Diagonal 1 ////////////////////

R: ctl(53) ? put(scl((x+y)*val(0,1,64),0,X+Y,0,255),3),
             put(scl((x-y)*val(1,1,64),-Y,X,0,255),4),
             put(scl(sin(get(4)+sin(get(3))/ctl(2)),-512,512,-Y,Y),7),
             put(get(7)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(53) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(53) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Diagonal 2 ///////////////
R: ctl(54) ? put(scl((x+y)*val(0,1,64),0,X+Y,0,255),3),
             put(scl((x-y)*val(1,1,64),-Y,X,0,255),4),
             put(scl(sin(get(3)+sin(get(4))/ctl(2)),-512,512,-Y,Y),7),
             put(get(7)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(54) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(54) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Rings ///////////////
R: ctl(55) ? put(scl(m*val(0,1,64),0,M,0,255),1),
             put(scl(d*val(1,1,255),-512,512,0,255),2),
             put(scl(sin(get(1)+sin(get(2))/ctl(2)),-512,512,-M,M),6),
             put(get(6)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(55) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(55) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Radial ///////////////
R: ctl(56) ? put(scl(m*val(0,1,64),0,M,0,255),1),
             put(scl(d*val(1,1,255),-512,512,0,255),2),
             put(scl(sin(get(2)+sin(get(1))/ctl(2)),-512,512,-M,M),6),
             put(get(6)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(56) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(56) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Checkers ///////////////
R: ctl(57) ? put(scl((y)*val(0,1,64),0,Y,0,255),7),
             put(scl((x)*val(1,1,64),0,X,0,255),12),
             put(scl(sin(get(12)+sin(get(7))/ctl(2)),-512,512,-Y,Y),4),
             put(scl(sin(get(7)+sin(get(12))/ctl(2)),-512,512,-Y,Y),5),
             put(get(4)>0?0:255,1),put(get(5)>0?0:255,2),
             put(get(1)^get(2),9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(57) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(57) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Diag. Checkers ///////////////

R: ctl(58) ? put(scl((x+y)*val(0,1,64),0,X+Y,0,255),7),
             put(scl((x-y)*val(1,1,64),-Y,X,0,255),12),
             put(scl(sin(get(12)+sin(get(7))/ctl(2)),-512,512,-Y,Y),4),
             put(scl(sin(get(7)+sin(get(12))/ctl(2)),-512,512,-Y,Y),5),
             put(get(4)>0?0:255,1),put(get(5)>0?0:255,2),
             put(get(1)^get(2),9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(58) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(58) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Dartboard ///////////////

R: ctl(59) ? put(scl(m*val(0,1,64),0,M,0,255),7),
             put(scl(d*val(1,1,255),-512,512,0,255),12),
             put(scl(sin(get(12)+sin(get(7))/ctl(2)),-512,512,-M,M),4),
             put(scl(sin(get(7)+sin(get(12))/ctl(2)),-512,512,-M,M),5),
             put(get(4)>0?0:255,1),put(get(5)>0?0:255,2),
             put(get(1)^get(2),9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(59) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(59) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a



Wavy Patterns | Zig Zag Patterns | Line Patterns 

 

Home | Download | Documents | Tips & Tutorials | Code Library | Help / User Group | Order