Jump to content
How to Install Plugins ×

Toon Filter


ownage

Recommended Posts

11 minutes ago, Sakana Oji said:

PAGE NOT FOUND 

 

In the future, please use archive.org to find the corresponding topics for old forum links.

In this case, the topic you're looking for is: https://forums.getpaint.net/topic/3474-ink-sketch-effect-plugin-now-with-source-code/

 

 

This is also the third time this week you have not followed the forum rules. On two separate occasions, Pixey and I both asked you to read and follow them.

There are reasons behind every one of those rules. You need to follow them.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • 10 months later...

I've been doing abstract art with Paint.net for around five years, and in that time I've found many different styles that I would cling to for a while. About four years ago I started using Ownage's Toon filter plugin posted in 2006 (https://forums.getpaint.net/topic/1671-toon-filter/), and I liked it mainly because of a method I found on the forums to create a nice cracked-surface effect. I'm not sure when exactly, but at some point a few years ago, the Toon filter disappeared from my effects list. I initially hadn't tried much except for making sure the .dll was still in my effects folder, which it was. I recently tried again by just re-downloading the plugin, but still no luck. It wasn't until tonight that I really sat down and tried to figure it out. I opened the .dll using 7Zip, and compared the files with those of effects I knew still worked, and still wasn't able to make it available. I'll now concede that I lack the knowledge required to fix it. So I scoured the forums trying to see if anyone else has had a similar issue, and when that didn't pan out, checked to see if Ownage might be available to ask about it. Seeing that they haven't visited since 2006, I decided to set up an account here (take a look through the forum rules so I don't mess this post up) and ask all you fine folk if you've experienced something like this, and if so, your possible solutions. I've included the first piece I made using the effect (resized to fit forum requirements).

Toon test.png

Link to comment
Share on other sites

It is not showing up for me either, and it is not appearing in plugin errors.

I will try rebuilding it from the source code, the DLL may be incompatible with the latest versions of Paint.NET.

 

Also,  this should have been posted in the plugin thread.

Perhaps one of the mods will move it there for you.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

I recompiled the effect from the source code in the first post.

Changes:

  • Moved it into the Artistic submenu
  • Added a Plugin Browser preview image (I cropped the example image in the first post)

 

46 minutes ago, welshblue said:

I always thought it was under Artistic but this one is at the bottom (of Mine) Effects tab

 

I was going to move it into Stylize, but Artistic is a better fit.

 

TOON.zip

 

Source code:

Spoiler

// Name: TOON
// Submenu: Artistic
// Author: ownage
// Title:
// Version: 1.0
// Desc:
// Keywords:
// URL: https://forums.getpaint.net/topic/1671-toon-filter/
// Help:

// filter kernel

const int size = 5; // odd number

//play around with the matrix for interesting effects.

int[,] conv = new int[size, size]
{
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  30,  -1, -1},
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  -5,  -1, -1},
};

unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
    int radius = (size-1)/2;
    for(int y = rect.Top; y < rect.Bottom; y++)
    {
        int top = y - radius, bottom = y + radius;
        if (top < 0) top = 0;
        if (bottom >= dst.Height) bottom = dst.Height - 1;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            int left = x - radius, right = x + radius;
            int c = 0, s = 0, r = 0, g = 0, b = 0;
            if (left < 0) left = 0;
            if (right >= dst.Width) right = dst.Width - 1;
            for (int v = top; v <= bottom; v++)
            {
                ColorBgra *pRow = src.GetRowAddressUnchecked(v);
                int j = v - y + radius;

                for (int u = left; u <= right; u++)
                {
                    int i = u - x + radius;
                    int w = conv[i, j];
                    ColorBgra *pRef = pRow + u;
                    r += pRef->R * w;
                    g += pRef->G * w;
                    b += pRef->B * w;
                    s += w;
                    c++;
                }
            }
            dst[x, y] = ColorBgra.FromBgr(
                Int32Util.ClampToByte(b),
                Int32Util.ClampToByte(g),
                Int32Util.ClampToByte(r));
        }
    }
}

 

 

  • Like 1
  • Upvote 4

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

13 hours ago, welshblue said:

Is this the one ?

 

toon.png

 

I always thought it was under Artistic but this one is at the bottom (of Mine) Effects tab

 

That's the one I have/had.

 

@null54 Thanks for updating the filter. I'll replace the file in the first post, unless you want to create a new thread?

Link to comment
Share on other sites

1 hour ago, Ego Eram Reputo said:

...unless you want to create a new thread?

 

I do not think that there is any point in creating a new thread.

 

I did not make any changes to the plugin's algorithm.

I only changed the menu category and added a Plugin Browser preview image.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

On 5/21/2020 at 12:28 PM, null54 said:

I recompiled the effect from the source code in the first post.

Changes:

  • Moved it into the Artistic submenu YES
  • Added a Plugin Browser preview image (I cropped the example image in the first post) ????????????
  Reveal hidden contents


// Name: TOON
// Submenu: Artistic
// Author: ownage
// Title:
// Version: 1.0
// Desc:
// Keywords:
// URL: https://forums.getpaint.net/topic/1671-toon-filter/
// Help:

// filter kernel

const int size = 5; // odd number

//play around with the matrix for interesting effects.

int[,] conv = new int[size, size]
{
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  30,  -1, -1},
    {-1,  -1,  -1,  -1, -1},
    {-1,  -1,  -5,  -1, -1},
};

unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
    int radius = (size-1)/2;
    for(int y = rect.Top; y < rect.Bottom; y++)
    {
        int top = y - radius, bottom = y + radius;
        if (top < 0) top = 0;
        if (bottom >= dst.Height) bottom = dst.Height - 1;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            int left = x - radius, right = x + radius;
            int c = 0, s = 0, r = 0, g = 0, b = 0;
            if (left < 0) left = 0;
            if (right >= dst.Width) right = dst.Width - 1;
            for (int v = top; v <= bottom; v++)
            {
                ColorBgra *pRow = src.GetRowAddressUnchecked(v);
                int j = v - y + radius;

                for (int u = left; u <= right; u++)
                {
                    int i = u - x + radius;
                    int w = conv[i, j];
                    ColorBgra *pRef = pRow + u;
                    r += pRef->R * w;
                    g += pRef->G * w;
                    b += pRef->B * w;
                    s += w;
                    c++;
                }
            }
            dst[x, y] = ColorBgra.FromBgr(
                Int32Util.ClampToByte(b),
                Int32Util.ClampToByte(g),
                Int32Util.ClampToByte(r));
        }
    }
}

 

 

 

Toon.jpg

Edited by Panchdara
Added jpg
Link to comment
Share on other sites

7 hours ago, Panchdara said:

Added a Plugin Browser preview image (I cropped the example image in the first post) ????????????

 

It looks like CodeLab is not embedding the preview image into the DLL, it also does not add it to the generated VS project.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

2 minutes ago, null54 said:

It looks like CodeLab is not embedding the preview image into the DLL, it also does not add it to the generated VS project.

 

I just looked at that code the other day, and know exactly where the bug is. Fixing...

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Add DLL to first post. I've cunningly hidden it behind a large blue download button.

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