Jump to content

Need help "plugging in" a plugin


AnneYusual
Go to solution Solved by toe_head2001,

Recommended Posts

1 hour ago, toe_head2001 said:

Once your plugin is compiled, ensure the DLL file has been copied into the Effects directory of Paint.NET.

Then you can start Paint.NET with the Visual Studio debugger.

Proceed to open your plugin from the Effects menu within Paint.NET.

When your plugin is run, your breakpoints in Visual Studio will break. (assuming the code path is executed)

Well, I finally got it to draw a spiral! Unbelievable.

 

I think this ought to be a tutorial, possibly the shortest ever. Of course, it must be preceded by the most important bit of information: What To Expect When You Are Expecting... Your Plugin To Execute In VisualStudio For The First Time: absolutely nothing is going to happen except for Paint.NET being started up for you.

 

Enlightenment hurts: not only did I not have a clue, but there was no way I was actually going to arrive at it, without being told. And after wasting a lot time and effort trying to solve a non-existent problem I got a bunch of people to do more of the same on my behalf. On that note, SORRY and THANK YOU!!! to everyone who chimed in to help!  👍

Link to comment
Share on other sites

3 hours ago, AnneYusual said:

I think this ought to be a tutorial, possibly the shortest ever.

 

We do have one, which is how I learned to do it back in the day.  The images are ancient, but still mostly accurate.

https://forums.getpaint.net/topic/4209-how-to-debug-your-plugin/

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

16 hours ago, toe_head2001 said:

 

We do have one, which is how I learned to do it back in the day.  The images are ancient, but still mostly accurate.

https://forums.getpaint.net/topic/4209-how-to-debug-your-plugin/

I managed to miss it - and, I promise, not for lack of trying.  It got buried pretty deep since 2007.  I don't know if your "admin" powers extend to "pinning" posts, but I think it's really in need of being pinned. Better yet - the four-line version - less chance of the next clueless novice plugin writer like myself missing the most important part: DON'T expect it to do the same thing when run in VS as when run in CodeLab, and here's what to do to make it work.

Link to comment
Share on other sites

On 10/1/2023 at 2:00 PM, AnneYusual said:

If I recall correctly, Graphics lives in using System.Drawing.Drawing2D

 

Also this is a good time to point out that I highly recommend migrating away from GDI+ (aka System.Drawing). Paint.NET now has robust support for Direct2D, which also happens to be hardware accelerated. Direct2D is the modern replacement for GDI and GDI+.

 

There is a learning curve, of course. You'd switch from BitmapEffect over to GpuDrawingEffect, and then issue drawing commands in your OnDraw() method to the IDeviceContext that you are given. All of the drawing commands get stashed in a buffer (a "command list", rather), and then Paint.NET does all the work to do tile based rendering, recover from GPU errors (like device removed, driver updated), etc.

 

This is all dependent on how deep into the rabbit hole you're interested in going, of course.

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

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

forumSig_bmwE60.jpg

Link to comment
Share on other sites

42 minutes ago, Rick Brewster said:

 

Also this is a good time to point out that I highly recommend migrating away from GDI+ (aka System.Drawing). Paint.NET now has robust support for Direct2D, which also happens to be hardware accelerated. Direct2D is the modern replacement for GDI and GDI+.

In principle, sounds fine to me. In practice? I've never done graphics programming. Up until fairly recently I've been exclusively into data analysis of one sort or another, so my understanding of how it's done is rudimentary at best. The closest I've come to graphics of any sort is dipping my toes into generative art, using p5.js - but, so far, have stayed on the abstract side of things, basically exploring mathematical objects. Even the plugin I'm working on: 90% of the code is abstract rules for how an object should behave. When it comes down to actually producing something visible, it'll generate a list of points which MUST be given to something that can manage to plot them on a surface and join them with curves, because I wouldn't know how to, myself.

 

The Drawing2D.Graphics class was simply the object I was able to find that would do the point plotting for me - I googled it. If you tell me I should use another object instead (and there are docs I can read about how to use it), that's cool, I'll use that one.

 

But, I suspect, if I were to try something that involves actual pixel manipulation, the learning curve would look a lot more like a learning cliff (when you say GDI and GDI+ I have no clue what you are referring to, I'd have to look it up and figure it out before so much as having an opinion). Since graphics programming has  never been a personal ambition of mine (possibly because Linear Algebra, which I had to take in college, was a scarring experience), I don't see scaling much of said cliff - unless, for some reason, someone decided to hire me as a graphics dev - possibly not the best plan. I'm not unwilling to learn, it's just that the current 5-year plan involves a lot of statistics and data science. This project is most likely a one-off.

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.

×
×
  • Create New...