Jump to content

Plugin references to Paint.NET dlls


midora
 Share

Recommended Posts

Regarding the switch to Paint.NET 4 and .NET 4.5.

Should we keep the references to the old dlls and stay with .NET 3.5 or is there an advantage to switch to the new dlls which require .NET 4.5? Are there new interfaces or features available?

midoras signature.gif

Link to comment
Share on other sites

Well, first off there's of course the question of "do you want to retain compatibility with Paint.NET 3.5?" If the answer is yes, you should keep using .NET 3.5 SP1 and make sure to compile using references to the Paint.NET 3.5.x DLLs.

 

There aren't really that many new things for plugins. There is EffectFlags.ForceAliasedSelectionQuality.

 

There is also comprehensive access to Direct2D and DirectWrite, however I'm not yet sure I'm comfortable giving the green light for plugins to use that. However, we're still at alpha so there's a lot of things I'm not yet comfortable with :) Maybe you can try it out and let me know what you think, and maybe I'll get more comfortable.

 

You can start by using one of the DrawingContext.From_____() methods in the PaintDotNet.Direct2D namespace in PaintDotNet.Core.dll. There is also a greatly simplified resource management system for Direct2D sitting in PaintDotNet.Framework.dll inside of the PaintDotNet.UI.Media namespace. Instead of using IDrawingContext.CreateSolidColorBrush(...) and managing the lifetime (e.g. calling Dispose()) of an ISolidColorBrush, you can instead create a SolidColorBrush (no "I") and the extension methods on IDrawingContext will automatically create and cache the ISolidColorBrush for you. You don't have to destroy your SolidColorBrush (it doesn't really use any resources by itself), although if you want to use it across multiple threads you'll need to Freeze() it.

 

You should wrap your use of DrawingCOntext.From____() in a using block. When the drawing context is created, that corresponds to calling ID2D1RenderTarget :: BeginDraw(), and then disposing the IDrawingContext corresponds to calling ID2D1RenderTarget :: EndDraw().

 

using (IDrawingContext dc = DrawingContext.FromGraphics(g))
{
    dc.FillRectangle(...);
}

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

Not making pressure, we are happy that you did the step to publish an alpha. And we know the amount of work behind it and to finish it.

 

I would expect there are two or three other new things ;-) Like new PropertyBased controls (Roller).

 

Playing with Direct2D may be fun.

 

So let's keep a copy of the 3.5 libs to be on the save side.

 

BTW: EffectFlags.ForceAliasedSelectionQuality is a small step to Unlimited (IgnoreSelection) flag ;-)

Edited by midora

midoras signature.gif

Link to comment
Share on other sites

I would like to ask a question or two to clarify the plugin situation.

 

    1. Plugins compiled using references to the paint.net 3.5.x dlls will continue to work with 3.5.x (obviously) and also 4.0?

 

    2. Plugins compiled using references to the paint.net 4.0 dlls will work with 4.0 but not 3.5.x?

 

    3. Am I correct to assume CodeLab generates plugins compatible with version(s) under the same reasoning as 1 and 2?

 

I'm trying to spell this out as clearly as possible because there are bound to be numerous questions arising from this.

Link to comment
Share on other sites

    1. Plugins compiled using references to the paint.net 3.5.x dlls will continue to work with 3.5.x (obviously) and also 4.0?

 

As long as the plugins do not access methods outside of the somehow specified plugin interface (i.e. Ui. helper methods) . These plugins may break. But this is nothing new.

midoras signature.gif

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.

 Share

×
×
  • Create New...