midora Posted January 28, 2021 Posted January 28, 2021 (edited) This topic is about OptionBasedLibrary an paint.net extension which allows developers to create an extended user interface for effect and filetype plugins. The standard plugin development uses paint.nets PropertyBased methods to setup the user interface and the communication with the main application. OptionBasedLibrary must be installed in the same folder as the paint.net application (not in the effects or filetype folder. Here are some of the features of the OptionBasedLibrary: Tab pages (this helps to structure the ui options and can help to avoid tbfi There will be a description and examples of how to use the library in the future. If there are any questions or feature request then feel free to add them to this topic. Warnings Don't set PropertyBasedLook = true in an ConfigurationOfDialog instance. Worst case scenario: paint.net will crash. Edited February 15, 2021 by midora 1 Quote
NSD Posted January 28, 2021 Posted January 28, 2021 OBL (OptionBasedLibrary) has the same problem as discussed here: In the meantime, the problem was solved in PDN, but it remained in the OBL. Quote
Rick Brewster Posted January 28, 2021 Posted January 28, 2021 Have you thought about hosting the source code on GitHub? Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
midora Posted January 28, 2021 Author Posted January 28, 2021 (edited) 2 hours ago, NSD said: In the meantime, the problem was solved in PDN, but it remained in the OBL. OK, I will check if I can reproduce this. Thanks for the hint. PS: I stumbled over Reds Brexit comment in this topic 😉. I just like to say that the people in GB had no experience with grassroots democracy like in Switzerland. And the result is that you got a divided country splitted in winners and loosers. This is not democracy this is ochlocracy. Just my two cents. But this is not the right place to discuss. Edited January 28, 2021 by midora Quote
midora Posted January 28, 2021 Author Posted January 28, 2021 1 hour ago, Rick Brewster said: Have you thought about hosting the source code on GitHub? After some clean up there is in general no reason not to do it. In the moment I just have an idea what I did in OBL 😉 OK there is one reason I would like to discuss with you first. Quote
midora Posted January 31, 2021 Author Posted January 31, 2021 In the meantime I'm able to build OBL and my Example plugin. Takes some time (after 5 years) to setup the build environment. @NSDI tried to reproduce the issue with the DoubleSlider checking some of the OBL plugins published in the forum, but wasn't able to find an example where the issue happens. Could you point to a plugin and the option? Quote
NSD Posted January 31, 2021 Posted January 31, 2021 Change Intensity slider to 8.00 than increase on NumericUpDown. Quote
midora Posted January 31, 2021 Author Posted January 31, 2021 OK thanks, I will check if I can reproduce it with a similar min/max and updown increment. Quote
midora Posted February 1, 2021 Author Posted February 1, 2021 I could reproduce and debug the issue using the same settings as in TextDistortion for a DoubleSlider in my ExamplePlugin. Seems the issue was exactly the same as Rick mentioned. A cast to int of the Slidercontrol after multiplying with the 10^DecimalPlaces. So this will be fixed in a futute version of OptionBasedLibrary. 1 Quote
NSD Posted February 1, 2021 Posted February 1, 2021 In the meantime Rick has introduced EffectOptions instead of EffectFlags with a number of features that are not recognized by OBL. Maybe you can update this? public EffectPlugin() : base(StaticName, StaticImage, SubmenuNames, new EffectOptions() { Flags = EffectFlags.Configurable, RenderingSchedule = EffectRenderingSchedule.None }) { } //Another Options: EffectRenderingSchedule.DefaultTilesForCpuRendering EffectRenderingSchedule.DefaultTilesForGpuRendering EffectRenderingSchedule.None EffectRenderingSchedule.SmallHorizontalStrips EffectRenderingSchedule.Tiles1024x1024 EffectRenderingSchedule.Tiles128x128 EffectRenderingSchedule.Tiles256x256 EffectRenderingSchedule.Tiles512x512 1 Quote
Rick Brewster Posted February 1, 2021 Posted February 1, 2021 Here are the docs for EffectRenderingSchedule, btw public enum EffectRenderingSchedule : long { /// <summary> /// The image is broken up into square tiles, the size of which is chosen automatically. /// Each call to Render() contains the scans for 1 tile. /// </summary> DefaultTilesForCpuRendering = -2, /// <summary> /// The image is broken up into square tiles, the size of which is chosen automatically. /// Each call to Render() contains the scans for 1 tile. /// </summary> DefaultTilesForGpuRendering = -1, /// <summary> /// The image is broken up into small horizontal strips that cover the full width up the image. /// </summary> /// <remarks> /// This is the "classic" rendering schedule up through version 4.0.21. /// </remarks> SmallHorizontalStrips = 0, /// <summary> /// There is only one call to the Effect's Render method, and all regions of interest are /// delivered at that time. This also means rendering is effectively single threaded. /// </summary> /// <remarks> /// This is the same behavior of the now-obsolete EffectFlags.SingleRenderCall. /// </remarks> None = 5, /// <summary> /// The image is broken up into 128x128 tiles. /// Each call to Render() contains the scans for 1 tile. /// </summary> /// <remarks> /// This generally works best for classic effects with the 4.0 rendering engine which is based on /// rendering 128x128 tiles. It is also appropriate for GPU/Direct2D effects on very small images. /// </remarks> Tiles128x128 = 0x1007, /// <summary> /// The image is broken up into 256x256 tiles. /// Each call to Render() contains the scans for 1 tile. /// </summary> /// <remarks> /// This is a good size for GPU/Direct2D effects on small-to-medium sized images. /// </remarks> Tiles256x256 = 0x1008, /// <summary> /// The image is broken up into 512x512 tiles. /// Each call to Render() contains the scans for 1 tile. /// </summary> /// <remarks> /// This is a good size for GPU/Direct2D effects on medium-to-large sized images. /// </remarks> Tiles512x512 = 0x1009, /// <summary> /// The image is broken up into 1024x1024 tiles. /// Each call to Render() contains the scans for 1 tile. /// </summary> /// <remarks> /// This is a good size for GPU/Direct2D effects on large-to-huge sized images. /// </remarks> Tiles1024x1024 = 0x100A, } 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
midora Posted February 1, 2021 Author Posted February 1, 2021 @NSDIn a second step we may do this. In the moment OBL still references PDN 3.5.11 dlls. But first I really like to recover as many of my plugins as possible using a single version of OBL (0.8?). Just to remember and figure out what I did there to get OBL to run. I have to setup git repositories for all the projects. This is not a one day job... 😉 1 Quote
NSD Posted February 1, 2021 Posted February 1, 2021 Of course, I understand that this is a job that will take some time and I will be patient. Good luck in everything you do. 🙂 Quote
midora Posted February 2, 2021 Author Posted February 2, 2021 Made some progress in recovery of OBL and was able to support the theme setting in PDN. As an example a screenshot of the 'Color Harmonies' plugin using the OBL in development. 3 1 2 Quote
midora Posted February 3, 2021 Author Posted February 3, 2021 BTW: Theme support was possible because of this topic. Thanks @toe_head2001. I have no idea which other new features I missed in the last 5 years... 1 Quote
Rick Brewster Posted February 5, 2021 Posted February 5, 2021 I just pinned that topic Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
toe_head2001 Posted February 13, 2021 Posted February 13, 2021 @Martin Osieka, when I try to use OptionDoubleVectorPan, it doesn't work correctly. Can you provide some example code that demonstrates its proper usage? Here's the code I'm using to test: protected override OptionControlList OnSetupOptions(OptionContext optContext) { return new OptionControlList { new OptionDoubleVectorPan(OptionNames.Position, optContext, 0.0, 0.0) { StaticBitmapUnderlay = new Bitmap(100, 100) } }; } Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab
midora Posted February 13, 2021 Author Posted February 13, 2021 @toe_head2001Works fine for me with your parameters. If you just provide defaults for x and y then the default range is -1 to 1. Not sure what's going wrong. Are you referencing OBL 0.7.9? Maybe give StaticBitmapUnderlay = this.EnvironmentParameters.SourceSurface.CreateAliasedBitmap() a try. Just to see if it works with the current image. Quote
midora Posted February 13, 2021 Author Posted February 13, 2021 Just a remark about different OBL versions. In the moment plugins are using 6 different versions of OBL. So you are getting a mess in the paint.net folder if you are using plugins based on OBL. For sure the goal was always to get OBL final regarding the basic interface and to remove the version number in the filename at this stage. Means from this final release only features will be added but plugins should continue to work with newer OBL version. Quote
NSD Posted February 13, 2021 Posted February 13, 2021 How (when) I use this control? OptionPanelPagesAsStackItems Quote
midora Posted February 13, 2021 Author Posted February 13, 2021 OptionPanelPagesABC only allows to add multiple OptionPanelPage controls. Only one is active. The others are hidden or disabled depending on the variant ABC. I do not remember exactly about OptionPanelPagesAsStackItems. I guess it was an experimental one and has not been finished. Or maybe lost in 2015. OptionPanelPagesAsTabs is the typical example. OptionPanelPagesAsStackItems should show just the title lines of the pages vertically. Only the active page shows the embedded option below of its title (I guess you know this from other application). Sometimes this more intuitive then AsTabs. There are more variants in experimental state. 1 Quote
toe_head2001 Posted February 13, 2021 Posted February 13, 2021 10 hours ago, midora said: Not sure what's going wrong. Are you referencing OBL 0.7.9? Yes, version 0.7.9. 10 hours ago, midora said: Maybe give StaticBitmapUnderlay = this.EnvironmentParameters.SourceSurface.CreateAliasedBitmap() a try. Just to see if it works with the current image. Yeah, that's what I tried first. It causes a crash: Exception details: System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at ControlExtensions.ControlPan.DrawToGraphics(Graphics g) at ControlExtensions.ControlPan.CheckRenderSurface() at ControlExtensions.ControlPan.DoPaint(Graphics g) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer) at System.Windows.Forms.Control.WmEraseBkgnd(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.UserControl.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab
midora Posted February 13, 2021 Author Posted February 13, 2021 Maybe there is issue in OnLayout of OptionControlList and width and height are getting zero. Did you test just with OptionDoubleVectorPan or a more complex OptionControlList? Quote
toe_head2001 Posted February 13, 2021 Posted February 13, 2021 3 minutes ago, midora said: Did you test just with OptionDoubleVectorPan or a more complex OptionControlList? I tried with just the OptionDoubleVectorPan, and with additional controls in the OptionControlList. Same result either way. Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab
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.