jchunn Posted February 26, 2008 Share Posted February 26, 2008 This is a template that will allow you to easily create PDN Effect Plugins with Visual Basic. Before you download it, please read ALL of these instructions carefully. VB_PDN_Effect.zip Ok, I know you didn't read all the instructions carefully before you downloaded that file, so once you mess around and it doesn't work, read ALL of these instructions carefully before you post any questions. If you follow these instructions and then you simply create a new project based on this template and compile it without any modifications, you will have a basic working plugin (in the form of a dll) that will work in Paint.Net right out of the box. I highly recommend you modify it before you post your new dll and start bragging about it. This was created and tested with VB.Net 2005 and Paint.Net 3.22, but should work with newer versions. Report issues here and I'll follow up when I can. Here is how to install and use the template: Step 1: DO NOT UNZIP THE FILE. Download the zip file and save it into your templates directory (something like "C:\Documents and Settings\Jesse Chunn\My Documents\Visual Studio 2005\Templates\ProjectTemplates"). DO NOT UNZIP THE FILE... Visual Studio knows how to handle the zipped file. DO NOT UNZIP THE FILE... EVER. Step 2: Run VB.Net and go to "File->New Project. You should see this new option: If you do not see that option, then you put the file in the wrong place, or you unzipped it, or the file is corrupt, or Venus is in retrograde... so look here and figure out what you did wrong: http://msdn.microsoft.com/msdnmag/issues/06/01/CodeTemplates/ Once you get that to work, go ahead and create a new project based on the template. Now, follow the instructions here: http://paintdotnet.forumer.com/viewtopic.php?f=6&t=4920. Once you have done all that, then all you have to do is run the app from the VB environment Paint.Net will start up with your plugin loaded and ready to test... and you will be on your way to creating some killer effects. Good Luck! Jesse Chunn Quote Total hack. Link to comment Share on other sites More sharing options...
Mike Ryan Posted February 26, 2008 Share Posted February 26, 2008 Great addition! First you prove you can make powerful plugins with VB.net, and now a template file. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
jchunn Posted February 26, 2008 Author Share Posted February 26, 2008 Great addition! First you prove you can make powerful plugins with VB.net, and now a template file. Thanks a lot! My pleasure bro. Thanks for the encouragement. Quote Total hack. Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 26, 2008 Share Posted February 26, 2008 This template is simply brilliant :!: I flicked the template through VB 2005 express last night and had the default *.dll running in PDN in minutes. Unbelievable :shock: So if you fancy creating an effect in Visual Basic rather than in the C#/Codelab system you should give this template a try. I highly recommend it! This template obviously took a fair amount of hard work to put together - many thanks to Jesse for making it available. Quote  ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
pyrochild Posted February 27, 2008 Share Posted February 27, 2008 Ewww! VB.NET! Eww! Still, if it gets more people writing plugins, I guess I really shouldn't complain. But... VB.NET... 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...
Ego Eram Reputo Posted February 27, 2008 Share Posted February 27, 2008 Ewww! VB.NET! Eww!Still, if it gets more people writing plugins, I guess I really shouldn't complain. But... VB.NET... I hear you :wink: but it's what I have installed. Yes I could d/l VS but I have a rural dial-up connection and the files are huge! My point was that this template does exactly what it is intended to do and is easy to use - even in a "humble" version of VB. Quote  ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
sanderevers Posted March 2, 2008 Share Posted March 2, 2008 VB.Net can do exactly the same thing as C#.Net can, in the end it's all .Net. Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 2, 2008 Share Posted March 2, 2008 VB.Net can do exactly the same thing as C#.Net can, in the end it's all .Net. Clearly, you are not a C# programmer. There are several things C# can do that VB.NET cannot. Such as unmanaged code; in VB.NET, your usage of pointers is pretty much limited to window handles and such. In C#, you have full pointer support, and therefore can directly manipulate memory, which is much faster than the equivalent managed code. Let's put it this way: If Paint.NET had been written in VB.NET, even very simple operations like Invert Colors, Black & White, or even the very basic concept of compositing one layer on top of another would be much, much, much slower. 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...
Simon Brown Posted March 2, 2008 Share Posted March 2, 2008 There are several things C# can do that VB.NET cannot. Such as unmanaged code; I thought only C++ could do unmanaged code. Or do you mean call Win32 DLLs? Quote Link to comment Share on other sites More sharing options...
pyrochild Posted March 2, 2008 Share Posted March 2, 2008 I mean unsafe blocks of code. You know, to use pointers. like private unsafe void myUnmanagedFunction() { //I can use pointers in here! } Using pointers is not managed by the CLR. Which is why it's considered "unsafe." 1 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...
jchunn Posted March 2, 2008 Author Share Posted March 2, 2008 And there are things you can do in C++ that you can't do in C#, and there are things you can do in Assembler that you can't do with C++, and there are things you can do with machine code that you cant do with Assembler, and there are things you can do with hardware that you can't do with machine code... so I guess "real" programmers do it with hardware. My point is that if I need to use pointers, I would probably go to C++. C# and VB.Net were created to utilize the .Net framework. I would propose that anyone using unsafe C# code on a regular basis probably should be using C++ anyway, like I do when I need pointers. For writing managed code, there is no significant difference between any two .Net languages. It is a matter of preference. If I were Rick, I would discourage the use of unsafe code in plugins. It will only serve to introduce instability and crashes, and will rarely make a significant difference in execution speed since the plugin model is multithreaded anyway. I'd love to see an example of a plugin that is "fast enough" using pointers that I can't write without pointers that is also "fast enough". If there is such a plugin, send me the source... I'll take the challenge gladly. At any rate, I think it is a shame that anyone goes out of their way anymore to bash VB. It is a great language. If some people don't like it, then they should just avoid it. There is nothing you can do in VB that you can't do in C#... so why even waste your energy with VB conversations? I went to a lot of trouble to create this template, and instead of encouragement to use it, I see somebody that has no intention of using it discouraging others, as if somehow the fact that it is VB is a big deal... why would you do that? Why not just leave it alone? Are you saying that VB cannot be used to write really excellent plugins (just as good as any out there today) because you can use unsafe code in C#? That is just silly. Quote Total hack. Link to comment Share on other sites More sharing options...
pyrochild Posted March 2, 2008 Share Posted March 2, 2008 I'm not "bashing" your template, and I am only expressing my distaste for VB.NET, and clarifying the misconception that anything done in C# can be done in VB.NET. My point is that if I need to use pointers, I would probably go to C++. C# and VB.Net were created to utilize the .Net framework. I would propose that anyone using unsafe C# code on a regular basis probably should be using C++ anyway, like I do when I need pointers.If you need to make extensive use of pointers, C++ is the way to go. But the fact is, C# is easier and faster to write for in almost all situations than C++, especially if there is any sort of GUI involved. When you're writing something as simple as a plugin, but want good performance and don't want to waste half your life writing C++ boilerplate, you simply can't beat C# with pointers.If I were Rick, I would discourage the use of unsafe code in plugins. That's just stupid. Pointers give a great performance boost over simply iterating through an array, and not taking advantage of that, if you know how, is rather dull. will rarely make a significant difference in execution speed since the plugin model is multithreaded anyway. I'd love to see an example of a plugin that is "fast enough" using pointers that I can't write without pointers that is also "fast enough". If there is such a plugin, send me the source... I'll take the challenge gladly.Obviously, you have not actually timed any array-loop code against its equivalent pointer-based code. It's faster. Period. Not only plugins, but also most of Paint.NET's own built-in effects and adjustments use pointers. Examples? Invert. Black & White. Sepia. Curves would be dreadfully slow without pointers. Pixelate as well. Splatter. Gradient bars. Gradient mapping would be excruciatingly slow without pointers.At any rate, I think it is a shame that anyone goes out of their way anymore to bash VB. It is a great language. If some people don't like it, then they should just avoid it. There is nothing you can do in VB that you can't do in C#... so why even waste your energy with VB conversations? I LOVE VB. It is a great language. I don't like VB.NET, but I'm not saying it's a bad language. And no, there is nothing that VB can do that C# can't. But the opposite is not true. C# can do more, and can do it with better performance fi the programmer knows his stuff. Are you saying that VB cannot be used to write really excellent plugins (just as good as any out there today) because you can use unsafe code in C#? That is just silly. Where did I ever say that your plugins weren't good? Where did I ever say that the template is not good? I seem to remember writing something along the lines of "if it gets more people writing plugins, I can't complain." You seem to have "overlooked" that little bit, simply so you could start flaming my opinions of the language. Respect--; for being unable to accept the fact that VB.NET is not always the perfect little tool for everything, and feeling the need to flame anyone who doesn't like it. 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...
jchunn Posted March 2, 2008 Author Share Posted March 2, 2008 Pyro, you have a tendancy to start this kind of thing anytime somebody other than yourself comes up with something useful. You hijack their thread with your negative comments and insults and start a fight, then act like you are so innocent... and eventually you get their thread locked when they try to stick up for themselves. Ewww! VB.NET! Eww!Still, if it gets more people writing plugins, I guess I really shouldn't complain. But... VB.NET... That is the post that you are defending, and you are trying to say that I am "overlooking" your love for VB. Give me a break. Exactly how is your original post productive? Why don't you please start a new thread to bash vb and leave this thread to the people that might actually want to use this template? There are only two possible outcomes with that kind of post... either everybody ignores it, which makes it totally useless, or somebody responds, in which case you completely hijack the thread. Congrats... you have hijacked the thread. Quote Total hack. Link to comment Share on other sites More sharing options...
pyrochild Posted March 2, 2008 Share Posted March 2, 2008 Congrats... you have hijacked the thread. Everything I have said in this thread so far has been directly related to your template. (Up until this post) Just because you don't agree with what I say doesn't mean it's hijacking. 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...
Simon Brown Posted March 2, 2008 Share Posted March 2, 2008 That is the post that you are defending, and you are trying to say that I am "overlooking" your love for VB. Give me a break. Exactly how is your original post productive? Why don't you please start a new thread to bash vb and leave this thread to the people that might actually want to use this template? There are only two possible outcomes with that kind of post... either everybody ignores it, which makes it totally useless, or somebody responds, in which case you completely hijack the thread. Congrats... you have hijacked the thread. He is saying that he likes your plugins - but hates VB.NET. And there have been tonnes of useful plugins he hasn't flamed. Quote Link to comment Share on other sites More sharing options...
St.Jim Posted March 21, 2008 Share Posted March 21, 2008 Feel like uninstalling VB!!!!!!! Got this error - Error 1 The command "copy "C:\Users\James\AppData\Local\Temporary Projects\VB_PDN_Effect1\bin\Release\test.dll" "c:\program files\paint.net\effects\"" exited with code 1. VB_PDN_Effect1 WTF! - lol, i was just seing what the original effect would do (no modifications and it throws me an error!) Why does it do this? Quote My DeviantArt Link to comment Share on other sites More sharing options...
pyrochild Posted March 21, 2008 Share Posted March 21, 2008 WTF! - lol, i was just seing what the original effect would do (no modifications and it throws me an error!) It looks like Pdn was running when it tried to copy the file over. You can't replace a file when the original is in use. 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...
jchunn Posted March 22, 2008 Author Share Posted March 22, 2008 The code works. Did you read the entire post (the post with the download link)? Is Paint.Net installed in the default location (c:\program files\paint.net)? The project is set up with a build action to copy the compiled dll to the "c:\program files\paint.net\effects" folder. If that folder is not there, you will have problems. If the folder is there, and Paint.Net is running, you will also have problems since (as Pyro pointed out) the dll will be in use by Paint.Net and therefore cannot be replaced. If you follow ALL of the instructions, then when you run your application, it will automatically copy the dll to the folder and then run Paint.Net for you, with your plugin in the menu. If you did not install Paint.Net to the default location, then you either need to remove the build action (and manually copy the dll to the effects folder when you want to test it), or modify it to point to the correct folder based on where you installed Paint.Net. Quote Total hack. Link to comment Share on other sites More sharing options...
St.Jim Posted March 22, 2008 Share Posted March 22, 2008 To be honest, I don't think I will bother with VB (or any other Programing language for that matter ) as PDN is in defualt location and everything is as it is... Quote My DeviantArt Link to comment Share on other sites More sharing options...
digpz Posted March 28, 2008 Share Posted March 28, 2008 In step 1, the path could be generalized to %userprofile%\My Documents\Visual Studio 2005\Templates I'm fairly certain there's a way to get the "My Documents" part too but I can't remember it right now. Quote Link to comment Share on other sites More sharing options...
jinx101 Posted December 4, 2008 Share Posted December 4, 2008 I'd like to say a few things. First, I love the resources on this site and the contributions from the community. This is good stuff. Second, thanks for posting the Vb template, it works great. Third, these ideological arguments about Vb vs. C# get old. C# does some things better without question but personally I prefer the additional functions that speed up common tasks I do in Vb. Honestly, when I want to use an unsafe code block, I'll just compile it into a library and include it in the Vb project. Not the cleanest approach, but it works well (for instance, I have a C# Bitmap class that uses Unsafe code that I use in Vb all the time, works very well and I get the best of both worlds... I think the term unsafe though is kind of misleading). Might not be the "preferred" solution, but it works well for me. I use both Vb and C# at work and like them both. I have a passion for BASIC though so I use it when possible while writing hobby projects (started on the C64 with BASIC and haven't looked back). Since I don't have a huge need to write code blocks that utilitize unmanged pointers, I don't run into the issues where I'd choose C# over VB (If I run into a huge performance problem here using Vb, I'll change to C# for the project). I actually understand both points of view, but some things just come down to preference and weighing whether you can accept the trade offs. Some people value the benefits of one language over another in different ways. I don't think that either are wrong, it's more about opportunity cost and what you value while programming. There is so much polarization with tech issues today that it's overwhelming at times (Vb vs. C#, .Net vs. Java, Java vs. Php, Windows vs. Mac, XP vs. Vista, Linux vs. the world). But back on topic, thanks for the template, it works great! Thanks to the community for all of the posts here, this is a wonderful site. I was going to put some UniCode art code I wrote into a plugin but I see it's already been done. Hehe. I'll have to think of something else to do. Quote Link to comment Share on other sites More sharing options...
jchunn Posted December 12, 2008 Author Share Posted December 12, 2008 Good post Jinx, and I look forward to seeing a plugin from you. Quote Total hack. Link to comment Share on other sites More sharing options...
oma Posted December 13, 2008 Share Posted December 13, 2008 just adding my 1/2 pennies worth here. I really don't care what language you all write plugin in just as long as they work , and quickly with the minimum of errors. would it be possible that when you write a plugin show in first post the language used VB.Net or C# .. mainly just to satify my curiosity. I'm still trying to learn from this massive tomb of a book on my desk, about code writing. ciao OMA Quote  My Deviant Art Gallery Oma's Paint.Net gallery Link to comment Share on other sites More sharing options...
Simon Brown Posted December 13, 2008 Share Posted December 13, 2008 would it be possible that when you write a plugin show in first post the language used VB.Net or C# .. mainly just to satify my curiosity All my plugins are written in C#. Quote Link to comment Share on other sites More sharing options...
oma Posted December 13, 2008 Share Posted December 13, 2008 thank Simon now I'll know who to pester when I finally buckle down and write a plugin. ciao OMA Quote  My Deviant Art Gallery Oma's Paint.Net gallery 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.