Jump to content
How to Install Plugins ×

Edge Detect Classic (for Paint.NET v5.0+)


BoltBait

Recommended Posts

The Stylize > Edge Detect effect was rewritten for Paint.NET v5.0 and several people have requested the old edge detect effect back.  So, here it is:

 

This is the "classic" (pre v5.0) version of Stylize > Edge Detect.

 

Download

 

EdgeDetectClassic.zip

 

Download this zip file to your desktop.  Unzip it.  Run the included Install_EdgeDetectClassic batch file.

 

After install, you should find the effect in the Effects > Stylize menu under the name of "Edge Detect Classic".

 

image.png

 

Source

 

CodeLab script:

 

Spoiler
// Name: Edge Detect Classic
// Submenu: Stylize
// Author: BoltBait
// Title: BoltBait's Edge Detect Classic v1.0
// Version: 1.0
// Desc: Old-School Edge Detect
// Keywords: edge|detect|classic
// URL: https://BoltBait.com/pdn
// Help: Edge Detect Classic v1.0\nUI ©2023 by BoltBait\nAlgorithm ©2004 by Chris Crosetto\nAll rights reserved.
#region UICode
AngleControl Amount1 = 45; // [-180,180] Edge Detect Angle
#endregion

EdgeDetectEffect edgedetectEffect = new EdgeDetectEffect();
PropertyCollection edgedetectProps;

protected override void OnDispose(bool disposing)
{
    if (disposing)
    {
        edgedetectEffect?.Dispose(); edgedetectEffect = null;
    }

    base.OnDispose(disposing);
}

void PreRender(Surface dst, Surface src)
{
    edgedetectEffect.EnvironmentParameters = EnvironmentParameters;
    edgedetectProps = edgedetectEffect.CreatePropertyCollection();
    PropertyBasedEffectConfigToken edgedetectParameters = new PropertyBasedEffectConfigToken(edgedetectProps);
    edgedetectParameters.SetPropertyValue(EdgeDetectEffect.PropertyNames.Angle, Amount1);
    edgedetectEffect.SetRenderInfo(edgedetectParameters, new RenderArgs(dst), new RenderArgs(src));
}

void Render(Surface dst, Surface src, Rectangle rect)
{
    edgedetectEffect.Render(new Rectangle[1] {rect},0,1);
}

 

 

Enjoy. :beer: B) 👍

 

 

  • Like 3
  • Upvote 1
  • Hooray 1
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...