Jump to content

Recommended Posts

I've made my first plugin in codelab. I've only coded with C++ and don't know of any libraries so expect it be a little funky. I could really use help with this as I don't even know I can complete the plugin using codelad. If someone could finish it that would be welcome. This will be an extremely useful plugin for Artists like myself.

1.0.0- before it's release it needs to be able to import a bitmap as a mask to modify the image. It should not be use the values for the current image like it is right now.

The code is based on the Warp sample from codelab. And thank you BoltBait for the early coding help!

here is an example of Photoshop's tool: http://revision3.com/pixelperfect/displacement/

0.0.2-Limited angle control: just for barkbark00 :-)

0.0.3

-Choose from Alpha, (Luminosity: Bleek II), and RGB: by madjik

-Semi-working Wrap control: by madjik (code only)

Link to post
Share on other sites

The lack of displacement map is why I haven't released it yet. I don't know how to have it open a new image. I'm just using codelab after all.

The angle controls aren't there because. 1: I want displacement maps first 2: I'm lazy and spent half a day on about 25 lines of code. I'm very busy so that will have to wait until later.

Link to post
Share on other sites

Sorry for asking for what you already said you wanted to add. It would've helped if I actually read your first post.

Anyway, I'm really beginning to like this plugin...

Try using it on clouds; it gives you a cool "marble" effect!

-------------------

As for the enhancements you spoke of. Take a look at Illnab1024's source for the Alpha Mask Import plugin...that lets you load an image...same with pleska's Photo Flood Fill plugin.

 

Take responsibility for your own intelligence. ;) -Rick Brewster

Link to post
Share on other sites

yeah, it's cool dude. It's a really simple code base but I do like what it can do to some textures. I makes them seem deeper in some cases. I, or who ever finishes the task, may want to include the option not to use a map and just use the current image. It really only feels useful around 1-12%; anything more than that and it's just silliness. But I wanted to allow for play. And I've added angle controls for you.

Link to post
Share on other sites

@BoltBait: You could go on for this, I'm busy on other project(s)...

Just for fun, this is a simple update of the code:

int Amount1 = 200;   //[-500,500]X Distort %
int Amount2 = 200;   //[-500,500]Y Distort %
int Amount3 = 1;     //[0,3]Channel: 0:A 1:R 2:G 3:B

int Amount4 = 1;     //[0,1]Wrap 
void Render(Surface dst, Surface src, Rectangle rect)
{
 PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
 Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();

 ColorBgra CP;
 float dif1, dif2, amo1, amo2;
 byte fx = 0;
 amo1 = (float)Amount1 / 100f;
 amo2 = (float)Amount2 / 100f;

 for(int y = rect.Top; y < rect.Bottom; ++y)
 {
   for (int x = rect.Left; x < rect.Right; ++x)
   {
     CP = src[x, y];
     switch (Amount3)
     {
       case 0:
         fx = CP.A;
         break;
       case 1:
         fx = CP.R;
         break;
       case 2:
         fx = CP.G;
         break;
       case 3:
         fx = CP.B;
         break;
       default:
         fx = CP.R;
         break;
     }
     dif1 = x + amo1 * (fx - 127);
     dif2 = y + amo2 * (fx - 127);
     if (Amount4 != 1)
     {
       if ((dif1 >= selection.Right) || (dif1 < selection.Left)) dif1 = x;
       if ((dif2 >= selection.Bottom) || (dif2 < selection.Top)) dif2 = y;
     }
     dst[x, y] = src.GetBilinearSample(dif1, dif2, true);
   }
 }
}

Link to post
Share on other sites
@BoltBait: You could go on for this, I'm busy on other project(s)...

Just for fun, this is a simple update of the code:

int Amount1 = 200;   //[-500,500]X Distort %
int Amount2 = 200;   //[-500,500]Y Distort %
int Amount3 = 1;     //[0,3]Channel: 0:A 1:R 2:G 3:B

int Amount4 = 1;     //[0,1]Wrap 
void Render(Surface dst, Surface src, Rectangle rect)
{
 PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
 Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();

 ColorBgra CP;
 float dif1, dif2, amo1, amo2;
 byte fx = 0;
 amo1 = (float)Amount1 / 100f;
 amo2 = (float)Amount2 / 100f;

 for(int y = rect.Top; y < rect.Bottom; ++y)
 {
   for (int x = rect.Left; x < rect.Right; ++x)
   {
     CP = src[x, y];
     switch (Amount3)
     {
       case 0:
         fx = CP.A;
         break;
       case 1:
         fx = CP.R;
         break;
       case 2:
         fx = CP.G;
         break;
       case 3:
         fx = CP.B;
         break;
       default:
         fx = CP.R;
         break;
     }
     dif1 = x + amo1 * (fx - 127);
     dif2 = y + amo2 * (fx - 127);
     if (Amount4 != 1)
     {
       if ((dif1 >= selection.Right) || (dif1 < selection.Left)) dif1 = x;
       if ((dif2 >= selection.Bottom) || (dif2 < selection.Top)) dif2 = y;
     }
     dst[x, y] = src.GetBilinearSample(dif1, dif2, true);
   }
 }
}

Madjik, what is the point in declaring another int Amount value if CodeLab can't build more than three sliders?

Link to post
Share on other sites

You can download Visual Studio Express for free...

 

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 post
Share on other sites
You can download Visual Studio Express for free...

I started the development of this plugin out of need not want. Although I taking a CS minor I'm a Fine Arts major and don't want to spend my time maintaining it as a tool. I think it would be better if someone experience in the field took it over. All this is not to say I did not enjoy making what I did and I may make more plugins in the future. Thank you of informing me of that though I may check it out. The more that Paint.net expands the less I have to think about using GIMP.

Link to post
Share on other sites

Also, if you're a student at an institute of higher education, Microsoft is offering its full version free-of-charge. https://downloads.channel8.msdn.com/

 

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 post
Share on other sites
Also, if you're a student at an institute of higher education, Microsoft is offering its full version free-of-charge. https://downloads.channel8.msdn.com/

Not really, I already checked that out a few days ago and it's a list of about 30 universities. My university is not on the list. I'm not going to say the normal bloody potato about Microsoft but it did sound too good to be true. I'm mostly an Ubuntu user and run XP through VMware. I really hope Mono Paint takes off.

http://code.google.com/p/paint-mono/

Link to post
Share on other sites
Also, if you're a student at an institute of higher education, Microsoft is offering its full version free-of-charge. https://downloads.channel8.msdn.com/

Not really, I already checked that out a few days ago and it's a list of about 30 universities. My university is not on the list.

Not quite. The list is their "easy" list. If you look around on the page, you'll find another way to get it if you go to a college that isn't on the list.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to post
Share on other sites
  • 2 weeks later...

Not quite. The list is their "easy" list. If you look around on the page, you'll find another way to get it if you go to a college that isn't on the list.

Thanks pyrochild, I was wrong about Microsoft this time. I got through their process; although it took a couple of days. I now have VS2008 but am totally lost. I've never programed in a GUI environment before. To make things worse most of the code I find to learn from is for VS2005 and/or old versions of Paint.Net. This plugin and myself could really use some help. All this plugin really needs to get off the ground is an open dialog box and to use the imported image as a mask.

thanks again,

Brian K.

Link to post
Share on other sites

Visual C# Express is free ... it should work fine for developing plugins.

http://www.microsoft.com/express/product/default.aspx

(VB Express, etc. are also free)

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to post
Share on other sites

But can use VS08 right? Why should I use that other program? I would think it must be simpler. I have no idea what I need to do to make a plugin in this thing. let's say I'm starting with the limited code I have right now. How do I make a UI for it, what system files do I need to reference, how do I handle an image variable for the mask??? If it would take too long to explain and it would be simpler just to finish the plugin yourself please feel free to do so, because I may not.

Link to post
Share on other sites
But can use VS08 right? Why should I use that other program? I would think it must be simpler. I have no idea what I need to do to make a plugin in this thing. let's say I'm starting with the limited code I have right now. How do I make a UI for it, what system files do I need to reference, how do I handle an image variable for the mask??? If it would take too long to explain and it would be simpler just to finish the plugin yourself please feel free to do so, because I may not.

Yes, you can use Visual Studio 2008. You should use that if you have it. To make a plugin, download the plugin template or an existing plugin and use that as a starting point, then ask questions once you get stuck. You should read, at least, the following posts (and ALL replies) before assuming you are stuck:

http://paintdotnet.forumer.com/viewtopic.php?f=5&t=2618

http://paintdotnet.forumer.com/viewtopic.php?f=6&t=4920

If you read those and are still not making progress, then I urge you to read as many posts in the Effects API forum as possible. There is no comprehensive documentation for the effects api... any information that is available has to be pieced together from these forums.

Total hack.

Link to post
Share on other sites
  • 2 weeks later...

I have this plugin building in VS2008 now, with some great help from Madjik. I have a real question now; this code gives me the current pixel values

void RenderRI(Surface dst, Surface src, Rectangle rect)

{

...

ColorBgra CP;

...

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

{

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

{

CP = src[x, y];

Is there a way to assign "CP" with values from another layer, preferably the layer below the current working layer. I ask this because I would like to use layers as masks.

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.

×
×
  • Create New...