Sign in to follow this  
ownage

Toon Filter

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Is this the one ?

 

toon.png

 

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

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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...

Share this post


Link to post
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.

Sign in to follow this