Jump to content

Line Tracer Plugin


Recommended Posts

A slightly different take on the sketch plugin.
You will find it in the Menu: Effects - > Artistic
 
Version 1.1 uploaded 10:15 PM Wednesday, June 12, 2013 (UTC) - Noise Filter Implemented
 
Line1.png?raw=1
.
 
Line3.png?raw=1
 
The Code:

 

Hidden Content:
// Submenu: Artistic
// Name: Line Tracer
// Title: Line Tracer - v1.0
// Author: TechnoRobbo
// URL: http://www.technorobbo
#region UICode
int Amount1 = 3; // [1,7] Line Width
int Amount2 = 4;// [1,10] Threshold
int Amount3 = 20;// [0,50] Color
#endregion


void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra CP;
    ColorBgra CO;
    ColorBgra CO2;
    ColorBgra H2O;
    int tmp =0;
    int tmp2 =0;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CP = src[x,y];
            CO = src.GetBilinearSampleClamped(x-Amount1,y-Amount1);  
            CO2 = src.GetBilinearSampleClamped(x-Amount1,y); 
            H2O = src.GetBilinearSampleClamped(x,y-Amount1); 
            HsvColor hsv = HsvColor.FromColor(CP.ToColor());
            HsvColor hsv2 = HsvColor.FromColor(CO.ToColor());
            HsvColor hsv3 = HsvColor.FromColor(CO2.ToColor());
            HsvColor hsv4 = HsvColor.FromColor(H2O.ToColor());
            int H = hsv.Hue ; 
            int S = Amount3 * hsv.Saturation/100 ;
            int V = Math.Abs(hsv.Value-hsv2.Value);
            tmp = Math.Abs(hsv.Value-hsv3.Value);
            tmp2 = Math.Abs(hsv.Value-hsv4.Value);
            if (V < Amount2 && tmp < Amount2 && tmp2 < Amount2){
                V=100;
            } else {
                V=0;
            }
            
            hsv = new HsvColor(H,S,V);


            ColorBgra NP = ColorBgra.FromColor(hsv.ToColor());
            NP.A = CP.A;  


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

Line Tracer.zip

Edited by TechnoRobbo
  • Upvote 2

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.

 Share

×
×
  • Create New...