TechnoRobbo

TR's Coquin Graduated Filter

Recommended Posts

TechnoRobbo's Coquin Graduated Filter


A simulation of the legendary Cokin Graduated Photographic Filter 


 


Back in the 70's a photographer named Jean Coquin invented a new style of filter called Cokin


 


http://en.wikipedia.org/wiki/Cokin


 


 


One of the most used filters in the Cokin is the graduated color filter.


 


http://www.cokin-filters.com/creative-system/


 


This simulation allows you to slide the filter up and down and rotate it just like the real fiter.


It does not add color to the picture it subtracts the complimentary colors simulating what a real photographic filter would do.


 


Menu: Effects -> Color


 


CoquinMenu.PNG?raw=1


 


No instructions - just play around.


 


dull2.png?raw=1


 


 


 


 


 


dull3.png?raw=1


 


 


dull4.png?raw=1


 


 


The Code


Hidden Content:


// Submenu: Color
// Name: TR's Coquin Filter
// Title: TR's Coquin Filter - v1.0
// Author: TechnoRobbo
// URL: http://www.technorobbo

#region UICode
double Amount1 = 0; // [-1,1] Offset
ColorBgra Amount2 = ColorBgra.FromBgr(0,0,0); // Tint
double Amount3 = -90; // [-180,180] Rotation
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
// Delete any of these lines you don't need
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 rad = Amount3 * Math.PI/180;
float shortside = (sel.Height > sel.Width) ? sel.Width : sel.Height;
shortside +=(float)Amount1 * shortside;

ColorBgra CP;
for (int y = rect.Top; y < rect.Bottom; y++)
{
for (int x = rect.Left; x < rect.Right; x++)
{
//========================================
PointF position = new PointF(x-CenterX,y-CenterY);
position.X =(float)Math.Cos(rad) * position.X -(float)Math.Sin(rad) * position.Y + CenterX;

//===========================================================

float grad = 1-( position.X / shortside);
grad = Math.Max(grad,0);
grad = Math.Min(grad,1);

CP = src[x,y];
int R = (int)((Amount2.B + Amount2.G)/2 * grad) ;
int G =(int)((Amount2.B + Amount2.R)/2 * grad) ;
int B =(int)((Amount2.R + Amount2.G)/2 * grad) ;
CP.R = Int32Util.ClampToByte((int)( CP.R - R ));
CP.G = Int32Util.ClampToByte((int)( CP.G - G ));
CP.B = Int32Util.ClampToByte((int)( CP.B - B ));
dst[x,y] = CP;
}
}
}



TRsCoquin.zip

Edited by TechnoRobbo

Share this post


Link to post
Share on other sites

Excellent, I have a collection of Cokin Filters for my old film camera.Now I can do it digitally.Nice one,cool plug-in.

Thank you for sharing.

Share this post


Link to post
Share on other sites

I like how this plugin works, the rotation adjustment is a cool extra that sets this apart from other similar plugins. I started with a picture of blue sky, white clouds and bright sun, made this with several other plugins and then applied the Coquin Graduated Filter to the layers before merging them together. I love your plugins TR but I can't make pictures fast enough to keep up with you,lol, and I'm loving it.   ;)

 

th_204-c-800x600_zps2e23fb8d.png

Share this post


Link to post
Share on other sites

Very nice - It looks real.

 

One interesting factoid. Coquin does not add color to the picture it subtracts the complimentary colors simulating what a real photographic filter would does.

 

(That sounded good. I'll add it to the description in the OP)

Edited by TechnoRobbo

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