Sign in to follow this  
BoltBait

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.

Share this post


Link to post
Share on other sites

It works but not how my brain can think of it >,< No way I can make this up on my own, but hey, im still learning ^^

Great tut Boltbait!

~EvilNeko

Share this post


Link to post
Share on other sites

I was playing around with one of the rainbow sample codes and changed the equations. I came up with a colour wheel that stays saturated. Is there already a plugin like this because it would be cool to release my first :P

Share this post


Link to post
Share on other sites

Good job BB,

/joke/

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; 
       } 
} 

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Sticky these. They will really help new programmers (like me)

Thanks. But, I don't like to sticky my own posts as that hardly seems fair. However, if another mod wants to do it, I wouldn't protest.

:D

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

You can write plugins in c++ I belive. Theres no tuts or anything on doing that, because most everyone here uses c#. You could probobly build off of these tuts, because c++ and c# arnt all too different.

Share this post


Link to post
Share on other sites

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 :(

Share this post


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

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