Jump to content

How to Write an Effect Plugin (Part 1 of 4 - Simple)

Recommended Posts

I've never been happy with the C# Code Syntax Highlighter here on this site, so this tutorial has been moved here:

If you have questions about the tutorial, you can post them here in this thread and I will address them.

Link to comment
Share on other sites

Good job BB,


but FireFly was asking for something easier than DotAtTheCenter.

You should have try DotAtZeroZero!

/end of joke/

What we are missing now is a topic where we could post our codelab!

Like this:

int Amount1=128;	//[1,256]Red  (1,256,dft=128)
int Amount2=128;	//[1,256]Green(1,256,dft=128)
int Amount3=128;	//[1,256]Blue (1,256,dft=128)

void Render(Surface dst, Surface src, Rectangle rect) 
   Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); 
   ColorBgra CurrentPixel; 
   for(int y = rect.Top; y < rect.Bottom; y++) 
       for (int x = rect.Left; x < rect.Right; x++) 
           CurrentPixel = src[x,y]; 
           CurrentPixel.R = (byte)(x%Amount1); 
           CurrentPixel.G = (byte)(y%Amount2); 
           CurrentPixel.B = (byte)((x+y)%Amount3); 
           dst[x,y] = CurrentPixel; 

Link to comment
Share on other sites

Hopefully, thanks to this tutorial, we will start seeing a bunch more plugins being published. And, hopefully, they won't all be completely useless. :D

"Look! I made an Invert Colors plugin!"

"Paint.NET can already do that..."

"I know, but mine is slower!"

"Why did you even bother?"

"Just to see if I could..."

"Great..." *bangs head on wall*


ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

I know C# (at least a little beyond the basics) but It has been confising to me because I can't do anything related to graphics or drawing. Especially making a plug-in for Paint.Net. This tutorial clarified a lot of things for me, but probably not enough for me to accually make a plug-in.

Link to comment
Share on other sites

  • 3 weeks later...
What's the for loop for?

The loop is for processing each pixel of the selection one at a time.

The "for y" loop steps through each row, from top to bottom.

    The "for x" loop steps through each pixel on the current row from left to right.
      When you are inside of the x loop, you are working on a single pixel on the destination canvas.

Each time you finish an X loop, it processes the next row in the Y loop.

Does that help?

Link to comment
Share on other sites

  • 1 month later...

At last i have found it!

My saviour!

i've always ben meaning to try to write my own plugin though now that i've seen this it confuses me a little .

if You say we need a little knowledge of C#, could someone please give me a link or something which explains how C# works?

For instance I don't understand why at the end of each line you go further and further and open (or close) a "{}"

Please help :(

Link to comment
Share on other sites

  • 4 months later...

I just downloaded the new version. I never use it, but maybe I won't fell lazy one day and make a plug-in. :P

---- Gallery | Sig Tutorial | deviantART | Sig Videos | PhotoBucket ----

D                  E                  S                  T                  I                 N                  Y

Link to comment
Share on other sites

hhhmmm ive been trying to learn C# this helps a little at the moment, i want to look over it more, that will probably help, i dont know if i know enough C# yet though :?


My deviantART iGraphix

~96% of teens won't stand up for God. Put this on your page if you're one of the 4% who will.

skilletism (n.) - The abnormal liking of the band "Skillet". (see PANHEAD)

panhead n. - an individual who shows extreme enthusiasm for the band Skillet. Generally driving for hours to concerts with frying pans riding shotgun.

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.

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