AnneYusual Posted June 15, 2023 Share Posted June 15, 2023 (edited) I'm new here: I often read forums, but usually avoid posting (I feel it's bad form to do a disappearing act when my interests change, which they frequently do). However, after perusing the available plugins (especially the ones that offer a peek at the code), various forum discussions, as well as some of the object definitions in the PaintDotNet.Effects dll over the past few days I'm no closer to figuring out the answer on my own, so it seems I have to bug other people with it. Yes, I'm aware of the "plugins may not modify canvas outside the selected region" rule, and I'm also aware that it's (possibly?) no longer in force (as several officially published plugins do that), though if that's been made official, I've failed to find where. I've seen some discussions on moving/rotating selections, but couldn't really tell from the context whether the point was to move/rotate the constituent pixels or the region itself. It appears no one has tried to create a Grow/Shrink Selection plugin, or even suggested that would be useful functionality to have - or, at least, my every attempt to find this topic came up empty. I suppose I should explain why I want one so much. A few years ago I made extensive use of Paint.Net to edit a large number of photos of a jewelry collection I created - and seeing as I really suck at photography, the editing was meant to make up for this shortfall and make the images look less sad (and closer to what the jewelry looks like "in person"). I gave up eventually - it was more work than I could handle: after a few months of concerted effort, the results were better, but still not good enough, plus all the clicking gave me tennis elbow, and a serious ergonomic hardware upgrade wasn't in the budget. In retrospect, having a simple way to increase/decrease the size of a selection (say, obtained with the Magic Wand tool) by 1-5 pixels, rather than having to employ various tricks (involving blurring mask layers, outlining selections, etc) to achieve the same end would have made a huge productivity difference. While this particular use case is no longer relevant to me, I assume it may still be relevant to someone attempting a large volume of photo-editing with limited resources. It's possible I'll be needing it again in the future as well. I've noticed that it's now possible to outline the "outside" of a selection, and a plugin already exists for that, so that does offer more of a shortcut, in case the answer to my question is "NO" (i.e. the selected region is a private object owned by the application and plugins may not update it.) At the moment, the main relevance of creating a plugin to me personally is just as a training exercise. I'm not new to programming, but I haven't touched .Net or C# for a little over a decade, and they've both changed A LOT since then. I'm also (mostly) a graphics newb (coding them, not using them) - my only experience being limited to a few p5js generative art sketches. Since I learn best by doing, and made-up exercises, lacking real-world stakes/constraints, just don't cut it, I've had to think of a real use-case, and I'm afraid creating some plugins for Paint.Net was all I could come up with. The grow/shrink selection functionality, however, is only a convenient first target, because it bugged me once upon a time not to have had it; if it turns out to be off limits, I'll figure out something else that might be of use. All comments/suggestions are welcome and appreciated. Edited June 15, 2023 by AnneYusual Quote Link to comment Share on other sites More sharing options...
Solution MJW Posted June 16, 2023 Solution Share Posted June 16, 2023 Plugins can now officially write outside the selection, though I believe that's limited to the two new-fangled varieties, not the "classic" plugin we know and love. Fortunately, one of the new style of plugins can do the things the old-style plugins can do. So far though, unless I somehow missed it, plugins still can't change the selection. You can write a modified selection to the clipboard, then load it with Paste Selection, but obviously that's a bit awkward and inflexible. 1 Quote Link to comment Share on other sites More sharing options...
AnneYusual Posted September 29, 2023 Author Share Posted September 29, 2023 Well, the only possible use of a plugin that would "grow" or "shrink" a selection in a program like Paint.NET that already lets you drag selections around to scale and rotate them is to allow the user to scale a selection in a very controlled manner and while remaining centered exactly like the original. It is essentially a productivity tool that would make something currently (theoretically, at least) possible, but technically difficult (good luck scaling an existing selection by one or two pixels all around while keeping it centered with a mouse!). It's a bit of a disappointment that I can't make one, but not the end of the world. Thank you, however, for clearing up the issue of whether it was currently possible, so I could stop barking up the wrong tree and try something else instead. I did, actually, end up trying something else, also on my personal wish-list of "hey, wouldn't it be nice if I could...". Unfortunately, it proved to be a great deal more complicated than I thought - as in, producing A LOT more code than I'd hoped for my first plugin. So much code, in fact, that I ended up making a mini-app - ostensibly for the purpose of getting all the logic worked out more conveniently than by running a debugger on top of Paint.NET. And now that I'm finally satisfied with how it works, I'm left scratching my head about how to plug it into a plug-in format, as originally intended. But I think that really ought to be its own topic - which it will be, as soon as I figure out the useful questions to ask Quote Link to comment Share on other sites More sharing options...
MJW Posted September 30, 2023 Share Posted September 30, 2023 From my long-ago days of using PaintShop Pro, I recall a number of uses for modifying selections, such as expanding or contracting by a pixel or so, or -- a favorite of mine -- smoothing the selection boundary. Quote 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.