Simon Brown Posted April 16, 2009 Posted April 16, 2009 Non plugin authors often don't know what is and isn't possible when writing plugins - so hopefully this should be helpful to users wishing to suggest plugins. "Classic" Effects (those deriving from Effect or PropertyBasedEffect) Effects can only access the current layer. However, BitmapEffects and GpuEffects can access all layers. Effects can only access the current image. Effects cannot know or change the blend mode or transparency of a layer. However, BitmapEffects and GpuEffects can. Effects can blend two images using transparency and blend modes. Effects can read the whole layer, even if part of it is selected. If part of a layer is selected, effects can only change that part. However, BitmapEffects and GpuEffects can write outside the selection if they specify the appropriate flag in their OnInitializeRenderInfo() method Although effects can't be tools or anything, they can show a new dialog to draw on. Effects can save files, but only with the information they have (see above) and they can't make the file they save the current FileName. Effects have no control over the UI other than the ability to add items and categories to the effects and adjustments menus. Effects can not change the shape of the selection or which pixels are selected. Most effects need to be heavily modified before they can run outside Paint.NET. Effects can open files and read them from your harddrive or Internet URL. Effects can read the Windows clipboard. As of paint.net 4.0.6: Effects can read all of the color values in the current and default palette Effects can add a [?] button to the effect's IndirectUI for adding a help file As of paint.net 5.0: BitmapEffect and GpuEffect are the new, modernized effect base classes. They can read from any layer. They can know the name, blend mode, and transparency of each layer. They can write outside the selection if they specify the appropriate flag in their OnInitializeRenderInfo() method. GpuEffect runs on the GPU, and is significantly faster for many things. They can read the image's ("document's") metadata (EXIF, XMP, and IPTC). FileTypes (Opening) FileTypes don't know the location of the image they're opening. FileTypes can create as many layers as they want and change opacity and blend modes. FileTypes must open some image. FileTypes have no control over the open dialog. FileTypes (Saving) FileTypes don't know the location of the image they're saving to. FileTypes can read all layers, opacity and blend modes. FileTypes have to save a file unless the user clicks "cancel," even if it is empty - this is frowned upon by Rick. FileTypes have no control over the save dialog. I hope this helps. 1 Quote
david.atwell Posted April 16, 2009 Posted April 16, 2009 Nice work. I'll definitely link to this when people post crazy ideas. :-) A few notes you might want to make, though: Plugins can put menu options in the Effects and Adjustments menu. Plugins can not make any changes to the Paint.NET user interface outside their dialog and their menu entry. Plugins can not run without Paint.NET, although they are able to connect to programs that can (such as Batch Processor and wrappers). Also, if I'm not mistaken, Rick frowns on saving an empty file with a filetype plugin (such as with the upload-to idea). 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.
Boude Posted May 12, 2009 Posted May 12, 2009 Is it possible to let an effect save one layer and then let the user runs the effect over the next layer and let the effect combine them some how? (not that I actually know how this could be done) Quote History repeats itself, because nobody was paying attention the first time.
Simon Brown Posted May 12, 2009 Author Posted May 12, 2009 Theoretically, but the plugin would have no way of knowing they were two layers of the same image. Quote
Boude Posted May 13, 2009 Posted May 13, 2009 Unless the user gives it that information ofcourse. Quote History repeats itself, because nobody was paying attention the first time.
jxp Posted July 9, 2009 Posted July 9, 2009 A couple more comments on file types; Filetypes have no control over the open/save dialog but can present their own dialog as well. When opening, a file type plugin can return null or a 0 size document (don't know which is preferred) if the user cancels a custom dialog. I have not found any good way to cancel a file type save dialog. I always end up with a zero byte file on disk. The Paint.net jpg dialog allows a cancel, but plugins don't seem to be able to be consistent with this Quote Don't know what plugin to use? Try looking in the plugin gallery
xmario Posted April 26, 2010 Posted April 26, 2010 Please advise me: Can the effect resize the selection?? Quote Russian paint.net community
pyrochild Posted April 26, 2010 Posted April 26, 2010 no Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it!
BoltBait Posted August 8, 2015 Posted August 8, 2015 As of paint.net 4.0.6: Effects can read all of the color values in the current and default palette Effects can add a [?] button to the UI for adding a help file Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game
sbhambra Posted July 5, 2020 Posted July 5, 2020 Can a plugin save flattened images using combinations of layers? I see that plugins cannot create layers. Quote
toe_head2001 Posted July 5, 2020 Posted July 5, 2020 14 minutes ago, sbhambra said: Can a plugin save flattened images using combinations of layers? I see that plugins cannot create layers. A FileType plugin can. An Effect plugin can not. Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab
Oli Posted November 11, 2021 Posted November 11, 2021 Hi there! Are effects able to read out a selection's dimensions in inch or millimeter and resize an image to a certain dimensions? Or: can effects read out the selection's dimensions in pixel and the resolution of the whole image in dpi and calculate a factor for resizing? Background: I need to resize companies' logos to prepare them to get converted into embroidery programms. So certain elements (for example text) must not be below a height of 5 millimeters. For example: I want to make a selection around the letter "M" (which has a height of 16 millimeters) inside a random logo and enter the desired height of 5 millimeters -> the whole image will be reseized to 31,25% to meet the requirement of the selected letter "M" being 5 millimeters in height. Thanks in advance for answering Oli 1 Quote
midora Posted November 11, 2021 Posted November 11, 2021 Since paint.net 4.2.16 DocumentResolution in the EffectEnvironmentParameters class contains the resolution of a document. But plugins are not able to change the dimension of a layer (or the image). If you like to scale the pixels of the whole image and keep the current dpi value then you can do this via Image->Canvas Size. If you like to scale the dpi value and keep the pixels then set the new dpi value in Image->Resize. The status bar provides you information about the size of the selection. You can change its unit via the small popup in the status bar (px, cm, in). Quote
Oli Posted November 11, 2021 Posted November 11, 2021 Thanks for your answer, midora. So I will have to stick to my calculator until I find a better possibility. Is there a documentation for this class you mentioned? Quote
midora Posted November 11, 2021 Posted November 11, 2021 In VisualStudio you can select EffectEnvironmentParameters and press F12. Quote
MJW Posted November 12, 2021 Posted November 12, 2021 14 hours ago, Oli said: So I will have to stick to my calculator until I find a better possibility. One possible approach that occurs to me to write a plugin that copies the image scaled to the desired size onto the clipboard, where it can be pasted into a new image. I have no idea if that works out for what you want to accomplish. Quote
Rick Brewster Posted November 12, 2021 Posted November 12, 2021 If you're going to use the clipboard in your plugin, be sure to make use of the `IClipboardService`, e.g. `this.Services.GetService<IClipboardService>()`. There are a lot of gotchas and hazards in using the clipboard, and the service gets rid of them for you. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
Rick Brewster Posted August 4, 2023 Posted August 4, 2023 Updated for 5.0 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
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.