Jump to content
How to Install Plugins ×

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

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

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

 

                                                              http://forums.getpaint.net/index.php?/topic/21233-skullbonz-art-gallery

Link to comment
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
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

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.

×
×
  • Create New...