Jump to content

Layer Cake Plugin


Recommended Posts

A new twist on the Twist.  Rotate your image in slices.

(The Original twist makes the image unrecognizable.)

 

Video instructions - http://youtu.be/Q6fPxBzQ4w8

 

This image was done with a round selection. (Mona's one Twisted sister.)

 

Distort -> Layer Cake

 

Bug Fix -Version 1.1 Fixes Zero Rotation Issue

 

10:38 AM Wednesday, June 12, 2013 (UTC)

 

bulleseye.png?raw=1

 

The Code:

 

Hidden Content:
// Submenu: Distort
// Name: Layer Cake
// Title: Layer Cake - v1.1
// Author: TechnoRobbo
// URL: http://www.technorobbo
#region UICode
double Amount1 = 0;//[-10,10]Rotation
double Amount2 = 5;//[1,30]Slices
#endregion


void Render(Surface dst, Surface src, Rectangle rect)
{


    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    int CenterX = ((selection.Right - selection.Left) / 2)+selection.Left;
    int CenterY = ((selection.Bottom - selection.Top) / 2)+selection.Top;
    double radX = (selection.Right - selection.Left) / 2;
    double radY = (selection.Bottom - selection.Top) / 2;
    double offrads = 0;
    double rads = 0;
    double slices = 0;
    int newx = 0;
    int newy = 0;
    double maxrad = Math.Sqrt(radX * radX + radY * radY);
    ColorBgra CP;
    
    rads=  Math.PI * (Amount1 +.001);
    
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        
        for (int x = rect.Left; x < rect.Right; x++)
        {
            
            slices = Math.Sqrt((x-CenterX) * (x-CenterX) + (y-CenterY)* (y-CenterY)) * rads / maxrad;         
            offrads = Math.Truncate(slices / (rads / Amount2)) * (rads / Amount2);


            newx=CenterX + (int)(Math.Cos(offrads) * (x-CenterX) + Math.Sin(offrads) * (y-CenterY));
            newy=CenterY + (int)(Math.Cos(offrads) * (y-CenterY) - Math.Sin(offrads) * (x-CenterX));
            CP = src.GetBilinearSampleWrapped(newx,newy);    


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

Layer Cake.zip

Edited by TechnoRobbo
  • Upvote 1

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

Nice effect!

 

Any number of Slices + Rotation: 0.00 and I get a completely filled layer in exactly one hue.  I anticipated getting a copy of the original (with zero rotation).

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...