Jump to content

How do you make a plugin?


Recommended Posts

I think that before you make any plugins, you should understand some more about how a computer works.

RGB colorspace is a very basic concept that you should have some understanding of before you start. For instance, do you know what color the hex code #FF0000 would produce (triplet 255, 0, 0)? Do you understand the additive model of color? Do you know what the color white is? If someone said "CMYK," would you know how to explain what that is to them?

In addition, your reply about coding makes it sound like you could study a bit more there, as well. For instance, everything in the computer world requires coding of some kind. A computer doesn't understand anything unless it's coded to it (it doesn't even understand code without a process that translates that code into binary digits that it can process). So teaching it something new is very difficult.

I hope you don't take this as a dig. I'm trying to help you understand that there are some very basic concepts you should know before you embark upon a programming journey. It's a very long process, and people spend years trying to master it. The fact that we only have five or six plugin authors who publish with any frequency whatsoever should tell you something about its difficulty. :-)

I also don't mean to discourage you. The fact that we only have half a dozen plugin authors means we could always use more. But it won't be easy. Not by a long shot. :-)

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Html, Xml, XHtml, Javascript, Php

They're generally for website development over program development.

I'd strongly recommend learning a C-based language, wherever it's just C, C++ or C#, or you will not find making a plugin very easy.

That said, coding of any kind is a very hard thing.

Link to comment
Share on other sites

  • 2 weeks later...

Sorry to necro this topic -.- But I would like to see if I cant figure out how this plugin works (Dot at center)

My notes are under lined

void Render(Surface dst, Surface src, Rectangle rect) This tells us its going to render using a series of rectangles

{

// Delete any of these lines you don't need

Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); This gets the parameters of your canvas as in Height and lenghth.

long CenterX = (long)(((selection.Right - selection.Left) / 2)+selection.Left); This uses a basic formula to find the middle of our x axis.

long CenterY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top); Same as above only for y axis

ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; The next three lines find our colors and the brush size.

ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;

int BrushWidth = (int)EnvironmentParameters.BrushWidth;

ColorBgra CurrentPixel; selecting the pixel, using C if im not mistaken

for(int y = rect.Top; y < rect.Bottom; y++)

{

for (int x = rect.Left; x < rect.Right; x++)

{

CurrentPixel = src[x,y];

if ((y == CenterY) && (x == CenterX))

{

// TODO: Add pixel processing code here And finally it gets colored

// Access RGBA values this way, for example:

CurrentPixel.R = (byte)PrimaryColor.R;

CurrentPixel.G = (byte)PrimaryColor.G;

CurrentPixel.B = (byte)PrimaryColor.B;

CurrentPixel.A = (byte)PrimaryColor.A;

}

dst[x,y] = CurrentPixel;

}

}

}

Sorry if this seemed noobish, but i am really interested in making effects. And considering my age,I have lots of time to learn :)

Link to comment
Share on other sites

Sorry to necro this topic -.- But I would like to see if I cant figure out how this plugin works (Dot at center)

My notes are under lined

void Render(Surface dst, Surface src, Rectangle rect) This tells us its going to render using a series of rectangles

{

// Delete any of these lines you don't need

Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); This gets the parameters of your canvas as in Height and lenghth.

long CenterX = (long)(((selection.Right - selection.Left) / 2)+selection.Left); This uses a basic formula to find the middle of our x axis.

long CenterY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top); Same as above only for y axis

ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; The next three lines find our colors and the brush size.

ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;

int BrushWidth = (int)EnvironmentParameters.BrushWidth;

ColorBgra CurrentPixel; selecting the pixel, using C if im not mistaken

for(int y = rect.Top; y < rect.Bottom; y++)

{

for (int x = rect.Left; x < rect.Right; x++)

{

CurrentPixel = src[x,y];

if ((y == CenterY) && (x == CenterX))

{

// TODO: Add pixel processing code here And finally it gets colored

// Access RGBA values this way, for example:

CurrentPixel.R = (byte)PrimaryColor.R;

CurrentPixel.G = (byte)PrimaryColor.G;

CurrentPixel.B = (byte)PrimaryColor.B;

CurrentPixel.A = (byte)PrimaryColor.A;

}

dst[x,y] = CurrentPixel;

}

}

}

Sorry if this seemed noobish, but i am really interested in making effects. And considering my age,I have lots of time to learn :)

Link to comment
Share on other sites

You're right, except for the "selecting pixel".

ColorBgra CurrentPixel;

simply creates a pixel.

CurrentPixel = src [x,y]

Here it "fills" (don't know if I can say this...my English is not very good...) the CurrentPixel pixel with the pixel located at the X and Y coords of the surface src.

dst [x,y] = CurrentPixel;

And here it "fills" the pixel located at the X and Y coords of the surface dst with CurrentPixel's value.

Link to comment
Share on other sites

You're right, except for the "selecting pixel".

ColorBgra CurrentPixel;

simply creates a pixel.

CurrentPixel = src [x,y]

Here it "fills" (don't know if I can say this...my English is not very good...) the CurrentPixel pixel with the pixel located at the X and Y coords of the surface src.

dst [x,y] = CurrentPixel;

And here it "fills" the pixel located at the X and Y coords of the surface dst with CurrentPixel's value.

Link to comment
Share on other sites

You're right, except for the "selecting pixel".

ColorBgra CurrentPixel;

simply creates a pixel.

Nearly right, but not quite :wink:. The line sets up a variable called CurrentPixel.

ColorBgra defines the type of variable that we are setting up, CurrentPixel is the name of that variable. Later when we use CurrentPixel in our code we know that it has been setup as a variable which holds color data [ColorBgra = ColorB(lue)g(reen)r(ed)a(lpha)].

In the original code see how ColorBgra is used to define the same variable type when we set the two variables PrimaryColor and SecondaryColor to the currently selected Primary and Secondary colors?

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.

 Share

×
×
  • Create New...