Bleek II Posted February 21, 2008 Share Posted February 21, 2008 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) Quote Link to comment Share on other sites More sharing options...
barkbark00 Posted February 21, 2008 Share Posted February 21, 2008 Pretty cool! Would you be able to have it load a separate image for the displacement map? Also, anyway to distinguish the controls for the horizontal and vertical push? Quote Take responsibility for your own intelligence. -Rick Brewster Link to comment Share on other sites More sharing options...
Bleek II Posted February 21, 2008 Author Share Posted February 21, 2008 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. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted February 21, 2008 Share Posted February 21, 2008 I'll look at this tonight, if MadJik hasn't beaten me too it. I have done another effect that loads a file: viewtopic.php?f=16&t=5558 Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Bleek II Posted February 22, 2008 Author Share Posted February 22, 2008 Thanks, BoltBait! also, I'm pretty sure the line dif =amo*(CP.R - 127); should changed to dif =amo*(CP.R - 128); just for the correctness.... Quote Link to comment Share on other sites More sharing options...
barkbark00 Posted February 22, 2008 Share Posted February 22, 2008 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. Quote Take responsibility for your own intelligence. -Rick Brewster Link to comment Share on other sites More sharing options...
Bleek II Posted February 22, 2008 Author Share Posted February 22, 2008 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. Quote Link to comment Share on other sites More sharing options...
MadJik Posted February 22, 2008 Share Posted February 22, 2008 @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); } } } Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
Andrew D Posted February 22, 2008 Share Posted February 22, 2008 @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? Quote Link to comment Share on other sites More sharing options...
MadJik Posted February 22, 2008 Share Posted February 22, 2008 I know that, but it's ready for the next version of the codelab. It's also a maner to tell 'Hey, Amount4 is a parameter you could play with'... in the codelab!! Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
BoltBait Posted February 22, 2008 Share Posted February 22, 2008 Madjik, what is the point in declaring another int Amount value if CodeLab can't build more than three sliders? This will not be a CodeLab script when it is done. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Bleek II Posted February 22, 2008 Author Share Posted February 22, 2008 I added case 1: fx = (CP.R+CP.G+CP.B)/3; break; for luminosity also I changed fx from a byte to an int. Quote Link to comment Share on other sites More sharing options...
Bleek II Posted February 23, 2008 Author Share Posted February 23, 2008 Once this plugin is complete could someone else publish and maintain? I don't have the software to do so myself. Quote Link to comment Share on other sites More sharing options...
david.atwell Posted February 23, 2008 Share Posted February 23, 2008 You can download Visual Studio Express for free... Quote 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 More sharing options...
Bleek II Posted February 23, 2008 Author Share Posted February 23, 2008 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. Quote Link to comment Share on other sites More sharing options...
david.atwell Posted February 23, 2008 Share Posted February 23, 2008 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/ Quote 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 More sharing options...
Bleek II Posted February 23, 2008 Author Share Posted February 23, 2008 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/ Quote Link to comment Share on other sites More sharing options...
pyrochild Posted February 23, 2008 Share Posted February 23, 2008 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. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Bleek II Posted March 6, 2008 Author Share Posted March 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted March 6, 2008 Share Posted March 6, 2008 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) Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
MadJik Posted March 7, 2008 Share Posted March 7, 2008 Visual C# Express is free ... it should work fine for developing plugins.http://www.microsoft.com/express/product/default.aspx Yes, it does! Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
Bleek II Posted March 9, 2008 Author Share Posted March 9, 2008 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. Quote Link to comment Share on other sites More sharing options...
jchunn Posted March 9, 2008 Share Posted March 9, 2008 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. Quote Total hack. Link to comment Share on other sites More sharing options...
Bleek II Posted March 18, 2008 Author Share Posted March 18, 2008 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. Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 18, 2008 Share Posted March 18, 2008 No. Effects do not have access to other layers. The only way to get another image's data is to load a file. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.