Popular Post VeLC Posted April 18, 2022 Popular Post Posted April 18, 2022 (edited) Draws text along an arc This is basically dpy's Circle Text plugin with a different UI and better math for proportional fonts Also in Effects > Text Formations Versions: 1.0(20220418) - Initial Release 1.1(20220420) - Now works with selection and slightly shorter UI 1.2(20220421) - Update code to make it compatible with CodeLab v6.1 (and below?). Also, detects if user canceled. 1.3(20220428) - Now works faster if there are multiple selections 1.4(20220506) - Fix space character not rendering when Character Spacing is zero and slightly shorter UI 1.5(20220513) - Code Update and slightly shorter UI CodeLab Code License: LPGL-3.0 Spoiler // Name: Arc Text // Submenu: Text Formations // Author: Louie Velarde // Title: Arc Text // Version: 1.5 // Desc: Draws text along an arc // Keywords: arc text|circle text|circular text // URL: https://forums.getpaint.net/topic/119904-arc-text/ // Help: https://forums.getpaint.net/topic/119904-arc-text/ // Force Single Render Call #region UICode TextboxControl text = ""; // [3600] IntSliderControl repeat = 1; // [1,360] Repeat FontFamily fontFamily = new FontFamily("Arial"); // IntSliderControl fontSize = 12; // [8,288] CheckboxControl bold = false; // Bold PanSliderControl center = Pair.Create(0.000, 0.000); // Center ListBoxControl alignment = 0; // |Start Position|Center Position|End Position AngleControl position = 135; // [0,360] CheckboxControl clockwise = true; // Clockwise CheckboxControl useAngle = true; // Calculate character spacing based on arc angle CheckboxControl endSpace = false; // Append space after last character IntSliderControl charSpacing = 0; // [0,100] {!useAngle} Character Spacing IntSliderControl angle = 90; // [0,360] {useAngle} Arc Angle IntSliderControl radius = 150; // [1,1000] Arc Radius #endregion bool rendered; void PreRender(Surface dst, Surface src) { rendered = false; } void Render(Surface dst, Surface src, Rectangle rect) { if (rendered) return; rendered = true; rect = EnvironmentParameters.SelectionBounds; dst.CopySurface(src, rect.Location, rect); if (text == string.Empty) return; StringBuilder line = new StringBuilder(text); for (int i = 2; i <= repeat; ++i) { if (IsCancelRequested) return; line.Append(text); } using (Graphics g = new RenderArgs(dst).Graphics) using (Region gClipRegion = new Region(rect)) using (Font font = new Font(fontFamily, fontSize, bold ? FontStyle.Bold : FontStyle.Regular)) using (Brush brush = new SolidBrush(EnvironmentParameters.PrimaryColor)) { g.Clip = gClipRegion; g.SmoothingMode = SmoothingMode.AntiAlias; g.TextRenderingHint = TextRenderingHint.AntiAlias; double translateX = rect.Left + (center.First + 1) / 2 * rect.Width; double translateY = rect.Top + (center.Second + 1) / 2 * rect.Height; g.TranslateTransform((float) translateX, (float) translateY); StringFormat format = new StringFormat(StringFormat.GenericTypographic); format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces; format.FormatFlags |= StringFormatFlags.NoFontFallback; SizeF[] sizes = new SizeF[line.Length]; double totalWidths = 0; double totalHeights = 0; for (int i = 0; i < line.Length; ++i) { if (IsCancelRequested) return; sizes[i] = g.MeasureString(line[i].ToString(), font, short.MaxValue, format); totalWidths += sizes[i].Width; totalHeights += sizes[i].Height; } double height = totalHeights / line.Length; double arcLength; if (useAngle) { arcLength = Math.PI * radius * angle / 180; } else { arcLength = totalWidths + charSpacing * (line.Length - 1); if (endSpace) arcLength += charSpacing; } double arcAngle = arcLength * 180 / Math.PI / radius; double spaceLength = (arcLength - totalWidths) / (line.Length - (endSpace ? 0 : 1)); double spaceAngle = spaceLength * 180 / Math.PI / radius; int s = clockwise ? 1 : -1; switch (alignment) { case 0: g.RotateTransform((float) (s * 90 - position)); break; case 1: g.RotateTransform((float) (s * 90 - position - s * arcAngle / 2)); break; case 2: g.RotateTransform((float) (s * 90 - position - s * arcAngle)); break; } double halfCharAngle = sizes[0].Width * s * 90 / Math.PI / radius; g.RotateTransform((float) (halfCharAngle)); float y = (float) (clockwise ? -radius : radius - height); g.DrawString(line[0].ToString(), font, brush, sizes[0].Width / -2, y, format); for (int i = 1; i < line.Length; ++i) { if (IsCancelRequested) return; g.RotateTransform((float) (halfCharAngle + s * spaceAngle)); halfCharAngle = sizes[i].Width * s * 90 / Math.PI / radius; g.RotateTransform((float) (halfCharAngle)); g.DrawString(line[i].ToString(), font, brush, sizes[i].Width / -2, y, format); } } } ArcText.zip Edited May 13, 2022 by VeLC Version 1.5 6 1 3 Quote
Panchdara Posted April 18, 2022 Posted April 18, 2022 (edited) Thanks! Question though. I see that in your ArcText.zip file the velc.ArcText.dll has file size 15872 and the install batch file has size 2842. I copied your code and placed in CodeLab and built the effect to ArcText.zip (on my desktop) and see the file sizes have changed to ArcText.dll == 15360 and the install batch file to 2832. Is there any reason? Is it due to .NET call differences? (version 6.0.3)?? Just asking. Works though. 👍 edit: figured the batch file sizes (velc.) Edited April 18, 2022 by Panchdara Quote
otuncelli Posted April 18, 2022 Posted April 18, 2022 11 hours ago, Panchdara said: I copied your code and placed in CodeLab and built the effect to ArcText.zip (on my desktop) and see the file sizes have changed to ArcText.dll == 15360 Probably the lack of window icon causes a smaller file. Quote
Panchdara Posted April 19, 2022 Posted April 19, 2022 7 hours ago, otuncelli said: Probably the lack of window icon causes a smaller file. 👍👍 Quote
VeLC Posted April 20, 2022 Author Posted April 20, 2022 Version 1.1 - Now works with selection and slightly shorter UI 2 1 Quote
NSD Posted April 20, 2022 Posted April 20, 2022 If Repeat>1 the text disappears. I used another variable (txt) to make it work. (CodeLab v6.1) StringBuilder sb = new StringBuilder(text); for (int i = 2; i <= repeat; ++i) { sb.Append(text); } string txt = sb.ToString(); Quote
VeLC Posted April 21, 2022 Author Posted April 21, 2022 Version 1.2 - Update code to make it compatible with CodeLab v6.1 (and below?). Also, detects if user canceled. 1 1 1 Quote
VCS Posted April 22, 2022 Posted April 22, 2022 how do i install the plugin like circle text to paint.net? can any one please help Quote
Rle Posted April 22, 2022 Posted April 22, 2022 👓https://forums.getpaint.net/topic/1708-how-to-install-pluginsgeneral-plugin-troubleshooting-thread/ Quote
homebrew Posted April 25, 2022 Posted April 25, 2022 how many separate text tools do we got? circle; circular and others. maybe we can agree on something Quote
BoltBait Posted April 25, 2022 Posted April 25, 2022 29 minutes ago, homebrew said: how many separate text tools do we got? circle; circular and others. maybe we can agree on something Just use the one you like and don't bother installing the rest. 1 Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game
VeLC Posted April 28, 2022 Author Posted April 28, 2022 Version 1.3 - Now works faster if there are multiple selections 3 1 Quote
VeLC Posted May 6, 2022 Author Posted May 6, 2022 Version 1.4 - Fix space character not rendering when Character Spacing is zero and slightly shorter UI 3 Quote
VeLC Posted May 13, 2022 Author Posted May 13, 2022 Version 1.5 - Code Update and slightly shorter UI 1 1 1 Quote
TheBlakeBox Posted June 26, 2022 Posted June 26, 2022 Is there any reason that command prompt tries open when I open the file? Seems pretty suspicious but let me know if there is a reason. Quote
mimccravey Posted September 30, 2023 Posted September 30, 2023 This is great for a top rocker, but what about a bottom rocker where the ends are curved up? I want to do two lines of text; one on the top curved down and one on the bottom curved up. Is there a plugin for that? Quote
AndrewDavid Posted September 30, 2023 Posted September 30, 2023 @mimccravey Welcome to the forum. Have a look at this one. Quote
Pixey Posted September 30, 2023 Posted September 30, 2023 And there is also this Plugin here. 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.
AndrewDavid Posted September 30, 2023 Posted September 30, 2023 @Pixey Do you see what you did? Pointing to yourself? Codelab now rejects the posted CS script with 4 errors. Could someone take the time to correct it please? I did half. double translateX = rect.Left + (center.First + 1) / 2 * rect.Width; double translateY = rect.Top + (center.Second + 1) / 2 * rect.Height; These posted scripts are valuable lessons to demonstrate plugin development. Quote
Pixey Posted September 30, 2023 Posted September 30, 2023 37 minutes ago, AndrewDavid said: Do you see what you did? Pointing to yourself? 😁 Silly me - I was jumping between posts and didn't notice 😂 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.
Zin Posted October 6, 2023 Posted October 6, 2023 I needed to change three lines (with the help of the following update thread. PanSliderControl center = new Vector2Double(0.000, 0.000); // Center double translateX = rect.Left + (center.X + 1) / 2 * rect.Width; double translateY = rect.Top + (center.Y + 1) / 2 * rect.Height; Quote
AndrewDavid Posted October 6, 2023 Posted October 6, 2023 Thank you @Zin Although the corrections now allow compiling in codelab, The Pan Slider Control does not function when the plugin is run. The good news is the ops DLL still works. I am running Codelab 6.9 and the thread link led me to believe this issue was resolved. Quote
Tabatha Posted October 31, 2023 Posted October 31, 2023 Hi I just bought paint and i tried to download this plugin however nothing downloads. super confused. I clicked on the zip file under the picture I have registered my account and nothing. please help. Quote
Pixey Posted October 31, 2023 Posted October 31, 2023 Hello @Tabatha an welcome to PDN I just checked the download and it is downloading alright. Please check your download file on your computer. It sounds like you have the Store Bought version of paint.net, so the Plugins are stored (after unzipping) in a new folder that you must generate. Please read halfway down this page: https://www.getpaint.net/doc/latest/InstallPlugins.html 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.
Farv Posted November 20, 2023 Posted November 20, 2023 Would be nice if radius >1000 was supported Quote
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.