BoltBait Posted August 23, 2018 Share Posted August 23, 2018 This will be officially released when Rick releases Paint.NET v4.1. CodeLab v4.0 Beta*: <snip> Beta 3 build Requires: Paint.NET v4.1+ New Features: Editor has tabs (toe_head2001) Colorwheel control now has Alpha style option (BoltBait) Filename control (BoltBait) Generate VS Project function on Build screen (toe_head2001) File > New templates have a new "Non Looping" style for all of your GDI+ work (BoltBait) Separate Save and Save As functions (toe_head2001) The autocomplete function now does matching initials (as described below) (toe_head2001) Minor bug fixes (toe_head2001 and BoltBait) New Features in the Second Beta: Indicator Map (Ctrl+M) now integrated with scroll bar (toe_head2001) Colorwheel control reset button can now be hidden (BoltBait) Building to DLL now saves to Desktop in a ZIP file all ready for posting to the forum (BoltBait) Install.BAT files now work for both the Classic install and the Store version of Paint.NET (BoltBait) Generate VS Solution function now has an updated Post Build Event script (BoltBait) New Features in the Third Beta: Fixed bug in smallest colorwheel (found by @xod) (BoltBait) Now, before anyone says anything... when running CodeLab it may prompt you to download v3.5. This is normal! Just ignore it. That error message won't be there once the official release happens. Check out this new UI feature, tabs: How to access the new Colorwheel with Alpha: How to generate a script for using GDI+ commands: *This download has been deleted as the official version has been released. 3 3 Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
BoltBait Posted August 23, 2018 Author Share Posted August 23, 2018 Here is a CodeLab script for using the new FilenameControl: // Name: Fill from file // Author: BoltBait #region UICode FilenameControl Amount1 = @""; // Open Image|jpg|png|gif|bmp #endregion Surface wrk = null; protected override void OnDispose(bool disposing) { if (wrk != null) wrk.Dispose(); wrk = null; base.OnDispose(disposing); } void PreRender(Surface dst, Surface src) { if (wrk == null) { wrk = new Surface(src.Size); } try { // Use your FilenameControl to load an image for use wrk = Surface.CopyFromBitmap((Bitmap)Bitmap.FromFile(Amount1)); } catch { wrk.Clear(ColorBgra.Transparent); } } void Render(Surface dst, Surface src, Rectangle rect) { for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { ColorBgra CurrentPixel = wrk.GetBilinearSampleWrapped(x,y); dst[x,y] = CurrentPixel; } } } Notice in the definition of the control, in the comment we have the title of the control followed by the file types allowed: FilenameControl Amount1 = @""; // Open Image|jpg|png|gif|bmp So, in this example, the prompt will be "Open Image" and the allowed file types will be .jpg, .png, .gif, and .bmp. For tinkering inside of CodeLab, between the quotes you can place a path to a file. (Notice that the @ sign before the first quote allows you to use the backslash character "\" without escaping it (doubling them). 1 Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
BoltBait Posted August 23, 2018 Author Share Posted August 23, 2018 On the File > New (Templates) screen, you can now choose a looping style of "None". This will generate a script like this: // Name: GDI+ Example // Author: BoltBait #region UICode #endregion // Working surface Surface wrk = null; // Setup for using Normal blend op private BinaryPixelOp normalOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Normal); protected override void OnDispose(bool disposing) { // Release any surfaces or effects you've created. if (wrk != null) wrk.Dispose(); wrk = null; base.OnDispose(disposing); } void PreRender(Surface dst, Surface src) { if (wrk == null) { wrk = new Surface(src.Size); } wrk.Clear(ColorBgra.Transparent); } // Here is the main render loop function void Render(Surface dst, Surface src, Rectangle rect) { using (Graphics g = new RenderArgs(wrk).Graphics) using (Region gClipRegion = new Region(rect)) using (Pen pen = new Pen(ColorBgra.Black, 1)) using (GraphicsPath path = new GraphicsPath()) using (SolidBrush brush = new SolidBrush(ColorBgra.Black)) using (Font font = new Font("Arial", 12)) { g.Clip = gClipRegion; g.SmoothingMode = SmoothingMode.AntiAlias; g.TextRenderingHint = TextRenderingHint.AntiAlias; pen.LineJoin = LineJoin.Round; // add additional GDI+ commands here } normalOp.Apply(dst, src, wrk, rect); } Notice that there are no loops in the Render method. In the Render method, CodeLab generates several "using" blocks. Just delete the ones you won't be using yourself. You'll probably want to modify the remaining "using" statements with user controls to make the various colors and sizes adjustable in your plugin. Finally, you can add additional GDI+ commands to render text, lines, and shapes to the wrk canvas which will then be combined with the source canvas to create your result. 1 Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
toe_head2001 Posted August 24, 2018 Share Posted August 24, 2018 (edited) Some other stuff you'll find in this 4.0 Beta: - The Save button is now an actual Save (Non-SaveAs) button. As separate SaveAs button is available in the File menu. - Matching of Initials in the AutoComplete box filter. db - DrawBezier isc - IntSliderControl (and of course IsCancelRequested is still listed, since it starts with isc) Edited August 25, 2018 by toe_head2001 2 (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Pratyush Posted August 26, 2018 Share Posted August 26, 2018 On 8/23/2018 at 9:26 AM, BoltBait said: New Features: Editor has tabs (toe_head2001) Thank you very much for tabs. @BoltBait & @toe_head2001 ? On 8/23/2018 at 9:26 AM, BoltBait said: This will be officially released when Rick releases Paint.NET v4.1. Version 4.1 is on its way!! I'm eager for the new things. ? Link to comment Share on other sites More sharing options...
BoltBait Posted September 1, 2018 Author Share Posted September 1, 2018 First post updated with the Beta 2 build of CodeLab. See above for a list of new features. Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
BoltBait Posted September 1, 2018 Author Share Posted September 1, 2018 On 8/22/2018 at 8:56 PM, BoltBait said: Building to DLL now saves to Desktop in a ZIP file all ready for posting to the forum Why did we do this?! Well, now that we have live preview in CodeLab itself, there really isn't as much of a need to "build to dll, install dll, run Paint.NET" to test your plugin. AND, people keep posting zipped DLL files to the forum without including the install.bat file that goes with them. So... I thought it would be convenient to just prepare the zip file for you. This way, it is all ready for you to post to the forum. PLUS, the new install.bat file that is built for you supports both the Classic version and the Store version of Paint.NET. 3 Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
xod Posted September 2, 2018 Share Posted September 2, 2018 Type: ColorWheel, Style: Default no Reset has some problems in preview mode. Doesn't render text. Link to comment Share on other sites More sharing options...
BoltBait Posted September 2, 2018 Author Share Posted September 2, 2018 53 minutes ago, xod said: Type: ColorWheel, Style: Default no Reset has some problems in preview mode. Doesn't render text. Show me. Nevermind. I'm able to reproduce the problem. Thanks for the bug report! ...Now, let's see if I can fix it. EDIT: Yup, CodeLab is generating the wrong code. Fix should be easy. EDITEDIT: Fix posted. 1 Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Recommended Posts