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

 

Alf's Pattern Examples #3


Wavy Patterns | Zig Zag Patterns | Line Patterns 

3. Line Patterns

From: Alfredo Mateus <almateus@globalsite.com.br>
To: fm@lists.best.com
Subject: FM: zig zagging
Date: Saturday, March 06, 1999 3:35 PM

Hi all, these are other patterns in the series. Some nice zig zag
patterns and the more common stripes. The last one was not adapted for
the multiple modes.

Alf


3.1 Step One

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

Click to download the zipped BMP file (pattern2.zip -- 25KB) 


3.2 Step Two

Copy and paste the following FF+ code into the FM source window.  Save the source code as file patterns-lines.ffp in the same directory where you unzipped the bitmap file above (pattern2.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 - Lines"
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="pattern2.bmp",stretched

// Control definitions:

ctl(0):"",val=4,range=(1,36)

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

ctl(60):GROUPBOX(GROUP),pos=(176,12),size=(170,108)

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(0, 4);
      }
      else if (ctl(52)) {
        // Horizontal
        setDialogText("Horizontal");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
      else if (ctl(53)) {
        // Diagonal 1
        setDialogText("Diagonal 1");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
      else if (ctl(54)) {
        // Diagonal 2
        setDialogText("Diagonal 2");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
      else if (ctl(55)) {
        // Rings
        setDialogText("Rings");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
      else if (ctl(56)) {
        // Radial
        setDialogText("Radial");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
      else if (ctl(57)) {
        // Checkers
        setDialogText("Checkers");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
      else if (ctl(58)) {
        // Diag. Checkers
        setDialogText("Diagonal Checkers");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
      else {
        // Dartboard
        setDialogText("Dartboard");
        setCtlText(0, ""); setCtlVal(0, 4);
      }
    }//if choice changed
  }//if doingProxy
  false; //doForEveryRow
} //ForEveryTile

//////////////////// Vertical ////////////////////
R: ctl(51) ?
  put(sin(scl(x,0,X,-512*ctl(0),512*ctl(0))),1), get(1)
   : R

G: ctl(51) ? get(1) : G

B: ctl(51) ? get(1) : B

A:a
 

//////////////////// Horizontal ////////////////////
R: ctl(52) ?
   put(sin(scl(y,0,Y,-512*ctl(0),512*ctl(0))),2),get(2)
   : R
 
G: ctl(52) ? get(2) : G

B: ctl(52) ? get(2) : B

A:a
 

//////////////////// Diagonal 1 ////////////////////
R: ctl(53) ?   put(sin(scl(y-x,-X,Y,-512*ctl(0),512*ctl(0))),3), get(3)
   : R

G: ctl(53) ? get(3) : G

B: ctl(53) ? get(3) : B

A:a
 

//////////////////// Diagonal 2 ///////////////
R: ctl(54) ?  put(sin(scl(x+y,0,X+Y,-512*ctl(0),512*ctl(0))),4),get(4)
   : R

G: ctl(54) ? get(4) : G

B: ctl(54) ? get(4) : B

A:a

//////////////////// Rings ///////////////
R: ctl(55) ?  put(sin(scl(m,0,M,-512*ctl(0),512*ctl(0))),5),get(5)
   : R

G: ctl(55) ? get(5) : G

B: ctl(55) ? get(5) : B

A:a

//////////////////// Radial ///////////////
R: ctl(56) ? put(sin(scl(d,-512,512,-512*ctl(0),512*ctl(0))),6),get(6)
   : R

G: ctl(56) ? get(6) : G

B: ctl(56) ? get(6) : B

A:a

//////////////////// Checkers ///////////////
R: ctl(57) ?put(sin(scl(x,0,X,-512*ctl(0),512*ctl(0)))>0^
                sin(scl(y,0,Y,-512*ctl(0),512*ctl(0)))>0?255:0,8),
                get(8)
                : R

G: ctl(57) ? get(8) : G

B: ctl(57) ? get(8) : B

A:a

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

R: ctl(58) ?put(sin(scl(x-y,-Y,X,-512*ctl(0),512*ctl(0)))>0^
                sin(scl(x+y,0,X+Y,-512*ctl(0),512*ctl(0)))>0?255:0,9),
                get(9)
            : R

G: ctl(58) ? get(9) : G

B: ctl(58) ? get(9) : B

A:a

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

R: ctl(59) ?put(sin(scl(m,0,M,-512*ctl(0),512*ctl(0)))>0^
                sin(scl(d,-512,512,-512*ctl(0),512*ctl(0)))>0?255:0,9),
                get(9)
            : R

G: ctl(59) ? get(9) : G

B: ctl(59) ? get(9) : B

A:a



Wavy Patterns | Zig Zag Patterns | Line Patterns 

 

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