Popular Post ReMake Posted March 15, 2019 Popular Post Share Posted March 15, 2019 (edited) This plugin is the result of discussion. You can find it: Effects -> Tools -> Center Lines Download from my PluginPack (obsolete version) For paint.net 5.0.11+ This plugin allows you to draw centerlines of various widths on the added layer in the center of the canvas or in the center of the selected area. You can also change the center of centerlines relative to the canvas or relative to the selected area. The Color's drop-down list allows you to select a line color: Primary, or Secondary, or Custom. Source code for CodeLab Spoiler // Name:Center Lines // Submenu:Tools // Author:ReMake // Title:Center Lines // Version:2.0 // Desc:Drawing auxiliary center lines // Keywords:paint.net|effect|center|lines // URL:https://www.getpaint.net/redirect/plugins.html // Help: #region UICode IntSliderControl lineWidth = 1; // [1,50] Line Width ListBoxControl color = 0; // Color|Primary|Secondary|Custom ColorWheelControl custom = ColorBgra.FromBgra(0, 0, 255, 255); // [Red?] {color} PanSliderControl position = new Vector2Double(0.000, 0.000); // Position #endregion protected override unsafe void OnDraw(IDeviceContext deviceContext) { deviceContext.DrawImage(Environment.SourceImage); // preserve background RectInt32 selection = Environment.Selection.RenderBounds; ColorBgra32 primaryColor = Environment.PrimaryColor; ColorBgra32 secondaryColor = Environment.SecondaryColor; ColorBgra32 lineColor = ColorBgra.Red; // converts the PanSlider values to between 0 and 1 double posX = (position.X + 1) / 2; double posY = (position.Y + 1) / 2; // shift of lines by 1 pixel to the right/down if posX/posY = 0 int shiftX = posX == 0 ? 1 : 0; int shiftY = posY == 0 ? 1 : 0; // converting posX/posY to actual pixel coordinates int centerX = (int)Math.Round(selection.Width * posX) + selection.Left + shiftX; int centerY = (int)Math.Round(selection.Height * posY) + selection.Top + shiftY; switch (color) { case 0: lineColor = primaryColor; break; case 1: lineColor = secondaryColor; break; case 2: lineColor = custom; break; } ISolidColorBrush brush = deviceContext.CreateSolidColorBrush(lineColor); deviceContext.AntialiasMode = AntialiasMode.Aliased; deviceContext.DrawLine( centerX, selection.Top, centerX, selection.Bottom, brush, lineWidth); deviceContext.DrawLine( selection.Left, centerY, selection.Right, centerY, brush, lineWidth); } The effect script is written based on an example from @BoltBait's CodeLab Help tutorial. Thanks @BoltBait for his amazing CodeLab Help. CenterLines.zip Edited October 30, 2023 by ReMake Added CodeLab script 7 3 Quote Link to comment Share on other sites More sharing options...
HyReZ Posted March 15, 2019 Share Posted March 15, 2019 Thank you sir! 1 Quote Link to comment Share on other sites More sharing options...
Pixey Posted March 15, 2019 Share Posted March 15, 2019 That looks cool @ReMake - thank you 1 Quote How I made Jennifer & Halle in Paint.net My Gallery | My Deviant Art "Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon. Link to comment Share on other sites More sharing options...
Seerose Posted March 15, 2019 Share Posted March 15, 2019 @ReMake! Thanks you for this tutorial. New is always better. I have a Center Line plugin. When I click on it does not show which author it is from. 1 Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi Link to comment Share on other sites More sharing options...
ReMake Posted March 15, 2019 Author Share Posted March 15, 2019 33 minutes ago, Seerose said: ...which author it is from. @Enormator author of previous plugins (see my comment). 1 Quote Link to comment Share on other sites More sharing options...
Seerose Posted March 15, 2019 Share Posted March 15, 2019 @ReMake! The old plugin is now deleted anyway. Yours is much better because you can choose color. 👍 Again many thanks for your effort. Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi Link to comment Share on other sites More sharing options...
lynxster4 Posted March 16, 2019 Share Posted March 16, 2019 Thank you @ReMake! This will come in handy. 🍰 1 Quote My Art Gallery | My Shape Packs | ShapeMaker Mini Tut | Air Bubble Stained Glass Chrome Text with Reflections | Porcelain Text w/ Variegated Coloring | Realistic Knit PatternOpalescent Stained Glass | Frosted Snowman Cookie | Leather Texture | Plastic Text | Silk Embroidery Visit my Personal Website "Never, ever lose your sense of humor - you'll live longer" Link to comment Share on other sites More sharing options...
ReMake Posted October 29, 2023 Author Share Posted October 29, 2023 The effect has been updated for paint.net 5.0.11+. Added a Line Width control and the ability to change the transparency of lines in Custom mode. The effect has been converted to take advantage of GPU capabilities. Download it from the first post. 1 1 Quote Link to comment Share on other sites More sharing options...
Pixey Posted October 29, 2023 Share Posted October 29, 2023 26 minutes ago, ReMake said: The effect has been converted to take advantage of GPU capabilities. Thank you @ReMake 1 Quote How I made Jennifer & Halle in Paint.net My Gallery | My Deviant Art "Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon. Link to comment Share on other sites More sharing options...
lynxster4 Posted October 30, 2023 Share Posted October 30, 2023 Thank you @ReMake The line width control makes a big difference! 😊 1 Quote My Art Gallery | My Shape Packs | ShapeMaker Mini Tut | Air Bubble Stained Glass Chrome Text with Reflections | Porcelain Text w/ Variegated Coloring | Realistic Knit PatternOpalescent Stained Glass | Frosted Snowman Cookie | Leather Texture | Plastic Text | Silk Embroidery Visit my Personal Website "Never, ever lose your sense of humor - you'll live longer" Link to comment Share on other sites More sharing options...
Welsh Yellow Cheddar Posted November 1, 2023 Share Posted November 1, 2023 @ReMake Thanks, very interesting for marking or delimiting sections. Could diagonals be added? Dashed lines with options to adjust the gap between the length of dashes would be great as well. Dots? Sorry if I ask too much. They are things I can use. 1 1 Quote Link to comment Share on other sites More sharing options...
ReMake Posted November 1, 2023 Author Share Posted November 1, 2023 6 hours ago, Welsh Yellow Cheddar said: Could diagonals be added? Dashed lines with options to adjust the gap between the length of dashes would be great as well. Dots? An interesting suggestion. If I have enough free time and my coding knowledge is enough, I will try to implement your suggestions. Now I'm focused on updating my previous plugins. 2 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.