Sign in to follow this  
Followers 0
TechnoRobbo

TR's ZigZag Plugin V1.1

4 posts in this topic

It Zigs! It Zags! It's a Ripple Plugin!


Version 1.1 includes Vertical Zig Zagging


 


 


Menu: Effects->Distort


 


The Modulator modifies the Carrier Amplitude.


 


ZZMenu.PNG?raw=1


 


The Example


ZigZag.png?raw=1


 


Valley of the Gods


ValleyoftheGods.png?raw=1


 


 


The Code


Hidden Content:



// Submenu: Distort
// Name: TR's ZigZag
// Title: TR's ZigZag - v1.1
// Author: TechnoRobbo
// URL: http://www.technorobbo
#region UICode
double Amount1 = 10; // [1,100] Carrier Frequency
double Amount2 = 0.5; // [0,3] Carrier Amplitude
double Amount3 = 0.5; // [0,1] Carrier Offset
double Amount4 = 2; // [1,100] Modulator Frequency
double Amount5 = 0.15; // [0,3] Modulator Amplitude
double Amount6 = 0; // [0,1] Modulator Offset
bool Amount7 = false; // [0,1] Vertical ZigZag
#endregion


void Render(Surface dst, Surface src, Rectangle rect)
{
    // Delete any of these lines you don't need
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    
    double CF=0,MF=0;
    if (!Amount7) {
        CF = selection.Width /Amount1;
        MF = selection.Width /Amount4;
    }else{
        CF = selection.Height /Amount1;
        MF = selection.Height /Amount4;        
    }
            
    double CA = CF * Amount2;
    double COF = CF * Amount3;
    double MA= MF * Amount5;
    double MOF = CF * Amount6;    
    
    
    ColorBgra CurrentPixel;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {
            double rad,off;
            if (!Amount7) {
                rad = ((x + COF) % CF) / CF * 2 * Math.PI ;
                off =Math.Cos(rad) * CA;
                rad = ((x + MOF) % MF) / MF * 2 * Math.PI ;
                off =y + Math.Cos(rad) * MA + off;
                CurrentPixel = src.GetBilinearSampleClamped(x,(int)off);
            }else{
                rad = ((y + COF) % CF) / CF * 2 * Math.PI ;
                off =Math.Cos(rad) * CA;
                rad = ((y + MOF) % MF) / MF * 2 * Math.PI ;
                off =x + Math.Cos(rad) * MA + off;
                CurrentPixel = src.GetBilinearSampleClamped((int)off,y);


            }
            dst[x,y] = CurrentPixel;
        }
    }
}
 


 


 


TRsZigZag.zip

Edited by TechnoRobbo
0

Share this post


Link to post
Share on other sites

Version 1.1 posted 


adds Vertical Zig Zag feature


 


 


 


Vzig.png?raw=1


Edited by TechnoRobbo
0

Share this post


Link to post
Share on other sites

I'm liking this.  A nice effect.  Many thanks for the update TechnoRobbo.

 

Is your source code up-to-date too?

0

Share this post


Link to post
Share on other sites

Yes the source code is up to date.

 

Now.

 

I forgot I had Vertical ZigZag mispelled. Thanks for catching it.

Edited by TechnoRobbo
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0