xod

Unfinished plugins

Recommended Posts

textonpath.png

 

 

@xod  you need to get a plugin pack together!  I'm counting over 20 plugins.  Why leave some of these excellent plugins in the 'Unfinished Plugins' thread??  :)

 

  • Like 2

Share this post


Link to post
Share on other sites

Custom Corner Frame plugin is located in Effects>>Render submenu

 

CHGgqBv.png

 

 

Od6pdbW.png

 

 

Download

Edited by xod
Replaced with a new version.
  • Like 5
  • Upvote 1

Share this post


Link to post
Share on other sites

@xod

Thanks for the timely update. I had thought that your original plugin had the features that Eli requested when I check yesterday and today it does.

Quick work indeed!

Share this post


Link to post
Share on other sites

Hello @xod ,

 

I have updated to the new version of Custom Corner Frame and I get an error when I try to use it. I did not get this error with the previous version. 

Spoiler

File: C:\Program Files\Paint.NET\Effects\CustomCornerFrame.dll
      Name: CustomCornerFrameEffect.CustomCornerFrameEffectPlugin
      Version: 1.0.1.0
      Author: Copyright ©2020 by xod
      Copyright: Custom Corner Frame
      Website: https://forums.getpaint.net/
      Full error message: System.MissingMethodException: Method not found: 'System.Drawing.Rectangle PaintDotNet.Effects.EffectEnvironmentParameters.get_SelectionBounds()'.
   at CustomCornerFrameEffect.CustomCornerFrameEffectPlugin.OnSetupOptions(OptionContext optContext)
   at OptionBased.Effects.OptionBasedEffect.CreateConfigDialog()
   at PaintDotNet.Menus.EffectMenuBase.RunEffectImpl(Type effectType) in D:\src\pdn\src\PaintDotNet\Menus\EffectMenuBase.cs:line 873
 

 

Edited by Eli
Problem solved when I updated to latest version of Paint.Net :)

Share this post


Link to post
Share on other sites

BoltBait explains in the Creative Text Pro v1.0 plugin code:

// For older Paint.NET use this line instead of the next:
// Rectangle selection = EnvironmentParameters.GetSelection(srcBounds).GetBoundsInt();
   Rectangle selection = EnvironmentParameters.SelectionBounds;

So, you did the right thing: Paint.net update.

Share this post


Link to post
Share on other sites

This plugin is based on Alexander Seel's code -> Text on Path with VB.NET and TechnoRobbo's code -> SplineMaster.
The plugin is located in Effects ► Text Formations.
It is slow on large canvas.

 

Text_on_Path.zip

  • Like 1
  • Upvote 1

Share this post


Link to post
Share on other sites

Hi @xod I have been enjoying the Custom Corner Frame plugin so much that I want it double if possible :) . It must be because I have been locked at home for 10 days already. 

Spoiler

double-corner-frames-572b50a.png

😄

 

  • Like 2

Share this post


Link to post
Share on other sites

I could not get this filter to work, so I decided to dump this in this thread in case anyone wants to finish and is searching for unfinished plugin

 

 

// Name: Axis-Based Shift Grouped Pixel to Boundary
// Submenu: Effects / Distortion
// Author: Reptorian
// Title: Axis-Based Shift Grouped Pixel to Boundary
// Version: .5
// Desc: Incomplete filter.
// Keywords:
// URL:
// Help:
#region UICode
DoubleSliderControl positionperc = 0; // [-100,100] Position of Pixels (%)
DoubleSliderControl influenceperc = 100; // [0,100] Influence Factor (%)
IntSliderControl alpha_threshold = 255; // [1,255] Alpha Threshold
ListBoxControl axis = 1; // Axis|Horizontal|Vertical
#endregion

int[] rowNonZeroAlphas = null;
int[] columnNonZeroAlphas = null;

void PreRender(Surface dst, Surface src)
{
    int w = src.Width, h = src.Height;
    if (rowNonZeroAlphas == null)
    {
        columnNonZeroAlphas = new int[w];
        rowNonZeroAlphas = new int[h];
        for (int x = 0; x < w; x++)
        {
            int nonZeroAlphaCount = 0;
            for (int y = 0; y < h; y++)
            {
                if (src[x,y].A >= alpha_threshold) {nonZeroAlphaCount++;}
                columnNonZeroAlphas[x] = nonZeroAlphaCount;
                dst[x,y]=ColorBgra.FromBgra(0,0,0,0);
            }
        }
        for (int y = 0; y < h; y++)
        {
            int nonZeroAlphaCount = 0;
            for (int x = 0; x < w; x++)
            {
                if (src[x,y].A >= alpha_threshold) {nonZeroAlphaCount++;}
                rowNonZeroAlphas[y] = nonZeroAlphaCount;
            }
        }        
    }
    else
    {
        for (int x = 0; x < w; x++)
        {
            for (int y = 0; y < h; y++)
            {
                dst[x,y]=ColorBgra.FromBgra(0,0,0,0);
            }
        }
    }
}

void Render(Surface dst, Surface src, Rectangle rect)
{
    double position = (positionperc / 100 + 1) / 2;
    double influence_factor = influenceperc / 100;
    double invert_factor = 1 - influence_factor;
    int w = rect.Right;
    int h = rect.Bottom;
    int tx,ty,nx,ny,fx,fy,N;
    double tny,tnx;
    
    if (axis==1)
        {
            for (int x = 0; x < w; x++)
            {
                if (IsCancelRequested) return;
                ny = h - 1;
                if (columnNonZeroAlphas[x] != 0)
                {
                    N=columnNonZeroAlphas[x];
                    ty = h - N ;
                    ny-=(int)(ty*position);
                    for (int y = h - 1; y >= 0; y--)
                    {
                        if (N != 0)
                        {
                            if (src[x,y].A >= alpha_threshold)
                            {
                                tny = influence_factor * (double)(ny) + invert_factor*(double)(y);
                                if (position == 1)
                                {
                                fy=(int)(Math.Ceiling(tny));
                                }
                                else
                                {
                                fy=(int)(Math.Floor(tny));
                                }
                                N--;
                                dst[x,fy] = src[x,y];
                                ny--;
                           }
                        }
                        else
                        {break;}
                    }
                }
            }
        }
    else
        {
            for (int y = 0; y < h; y++)
            {
                if (IsCancelRequested) return;
                nx = 0;
                if (rowNonZeroAlphas[y] != 0)
                {
                    N=rowNonZeroAlphas[y];
                    tx = w - N ;
                    nx+=(int)(tx*position);
                    for (int x = 0; x < w; x++)
                    {
                        if (N != 0)
                        {
                            if (src[x,y].A >= alpha_threshold)
                            {
                                tnx = influence_factor * (double)(nx) + invert_factor*(double)(x);
                                if (position == 0)
                                {
                                fx=(int)(Math.Ceiling(tnx));
                                }
                                else
                                {
                                fx=(int)(Math.Floor(tnx));
                                }
                                N--;
                                dst[fx,y] = src[x,y];
                                nx++;
                           }
                        }
                        else
                        {break;}
                    }
                }
            }
        }
}

 

 

Edited by Reptillian

Share this post


Link to post
Share on other sites

One thing I noticed is that in PreRender you have:

dst[x,y]=ColorBgra.FromBgra(0,0,0,0);

 

I don't think that's kosher. As far as I know, you can only write to the destination buffer in Render, and then only within the Rectangle-Of-Interest.

Share this post


Link to post
Share on other sites
6 minutes ago, MJW said:

One thing I noticed is that in PreRender you have:


dst[x,y]=ColorBgra.FromBgra(0,0,0,0);

 

I don't think that's kosher. As far as I know, you can only write to the destination buffer in Render, and then only within the Rectangle-Of-Interest.

 

Then, that must be part of the problem. I wanted to clear dst surface to zero as I noticed problem without doing that. The rectangle of interest is another thing that should have worked, and I checked with G'MIC-QT version of the filter, and checked the numbers of non-zero alpha between the shifted version and the non-shifted version. The expected result is exactly like the G'MIC-QT version. The code should be identical now. So, I'm lost there too.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Also,

 for (int x = 0; x < w; x++)
 {
    int nonZeroAlphaCount = 0;
    for (int y = 0; y < h; y++)
    {
        if (src[x,y].A >= alpha_threshold) {nonZeroAlphaCount++;}
        columnNonZeroAlphas[x] = nonZeroAlphaCount;
        //dst[x,y]=ColorBgra.FromBgra(0,0,0,0);
    }
}

Would be better as:

 for (int x = 0; x < w; x++)
 {
    int nonZeroAlphaCount = 0;
    for (int y = 0; y < h; y++)
    {
        if (src[x,y].A >= alpha_threshold) {nonZeroAlphaCount++;}
        //dst[x,y]=ColorBgra.FromBgra(0,0,0,0);
    }
    columnNonZeroAlphas[x] = nonZeroAlphaCount;
}

The point of using a local variable to accumulate the count is to avoid an array index. It's probably not worth the effort, and could be the simpler:

for (int x = 0; x < w; x++)
 {
    int nonZeroAlphaCount = 0;
    for (int y = 0; y < h; y++)
    {
        if (src[x,y].A >= alpha_threshold)
           columnNonZeroAlphas[x]++;
        //dst[x,y]=ColorBgra.FromBgra(0,0,0,0);
    }
}

 

Share this post


Link to post
Share on other sites
16 minutes ago, Reptillian said:

 

Then, that must be part of the problem. I wanted to clear dst surface to zero as I noticed problem without doing that.

 

Assuming dst can't be written in PreRender() (as I believe it can't), you've got to figure out a way to do it in Render(). It that's impossible, you need to use an auxiliary surface, do the rendering to it in PreRender(), and copy the results to dst in Render(). That's not ideal, but it's necessary for algorithms that only go in the source-to-destination direction; that is, algorithms where you can't take the destination coordinates, and figure out what color should be there.

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.