## Recommended Posts

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.

No instructions - just play around.

The Code

Hidden Content:

```
// 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);
//===========================================================
float grad = 1-( position.X / shortside);
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

Go out there and be amazing. Have Fun, TR

Some Pretty Pictures Some Cool Plugins

##### Share on other sites

Another top class plugin, very useful.

##### 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 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.

##### 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

Go out there and be amazing. Have Fun, TR

Some Pretty Pictures Some Cool Plugins

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×