Sign in to follow this  
Followers 0
TechnoRobbo

TR's Pixel Pusher

5 posts in this topic

TechnoRobbo's Pixel Pusher


 


A truly sandbox effect


Pixel pusher lets you manipulate image in a unique free form fashion.


 


Menu: Effects - > Distort


 


PixelPusherMenu.PNG?raw=1


 


 


Video Demo



 


gw.jpg?raw=1


 


jm.jpg?raw=1


 


The Code


Hidden Content:


// Submenu: Distort
// Name: TR's Pixel Pusher
// Title: TR's Pixel Pusher - v1.0
// Author: TechnoRobbo
// URL: http://www.technorobbo


#region UICode
Pair<double, double> Amount1 = Pair.Create( 0.0 , 0.0 ); // From
Pair<double, double> Amount2 = Pair.Create( 0.0 , 0.0 ); // To
double Amount3 = .4; // [0,1] Size
#endregion


// Here is the main render loop function
void Render(Surface dst, Surface src, Rectangle rect)
{
Rectangle sel = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
int CenterX = ((sel .Right - sel .Left) / 2) + sel .Left;
int CenterY = ((sel .Bottom - sel .Top) / 2) + sel .Top;
double fx = CenterX * (float)Amount1.First + CenterX;
double fy = CenterY * (float)Amount1.Second + CenterY;
double tx = CenterX * (float)Amount2.First + CenterX;
double ty = CenterY * (float)Amount2.Second + CenterY;
double rad = Math.Sqrt((tx - fx) * (tx - fx) + (ty - fy)*(ty - fy));
double wide = sel.Width * Amount3 +.0001;
dst.CopySurface(src,rect.Location,rect);

for (int y = rect.Top; y < rect.Bottom; y++)
{
for (int x = rect.Left; x < rect.Right; x++)
{
double dl = Math.Sqrt((x-fx)*(x-fx) + (y-fy)*(y-fy))/rad;
double dw = Math.Sqrt((x-tx)*(x-tx) + (y-ty)*(y-ty))/wide;
if (dl<1 || dw <1){
dl = Math.Min(dl,1);
dl *=dl;

dw = Math.Min(dw,1);
dw *=dw;

double nx= fx * dl + x - dl * x;
double ny= y * dl + fy - dl * fy;

nx= x * dw + nx - dw * nx;
ny= y * dw + ny - dw * ny;

ColorBgra CP = src.GetBilinearSampleClamped((int)nx,(int)ny);

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



TR's Pixel Push.zip

Edited by TechnoRobbo
1

Share this post


Link to post
Share on other sites

Lol,I love this guy,lol,Thanks for being you TechnoRobbo.  ;)    Just when I think you can't possibly top your other cool plugins you pop out another one.  This one looks like I am going to have some real fun with my family pics,heh,heh,heh.  If you don't see me for awhile it's because they hung me,lol.

0

Share this post


Link to post
Share on other sites

Damn.  For code that short, this plugin shouldn't be this much fun.   I love the video!  :star:

0

Share this post


Link to post
Share on other sites

This will be cool for adding some Salvador Dali styled mutilations to images. Nice one B)

pixelpush.png

Edited by DrewDale
0

Share this post


Link to post
Share on other sites

Skull and EER

Thank you for the kind words.

 

and EER ,

 

It's not the size of the code but how you use it. :bertie:

 

DrewDale - This will be cool for adding some Salvador Dali styled mutilations to images. 

 

DD,

 

That is exactly, I mean exactly  what I was thinking. I wanted to melt alarm clocks. Before I even had one ounce of math on my spreadsheet I had the name "TR's Dali Plugin". I then thought that might be too obscure, I learned my lesson with Bokeh, so I made the name something you could visualize.

couldn't resist

dali.png?raw=1

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