dracho Posted June 12, 2016 Share Posted June 12, 2016 Hello. I love Paint.net and have been using it for several years. Thank you for the great software. I am working on a new project, a Minecraft map, and it would help immensely to have the center of the image I'm editing read as 0,0. This way, I can hover over a portion of the image (it's a top-down view of a world) and be able to easily see where I need to go in-game to check it out. Of course, 0,0 in Paint.net is the upper-left corner of the image (and this is "correct" for 99.99% of applications.) Minecraft spawn is 0,0 and extends into the negatives in the south and west directions and into the positive in the north and east. I realize I could use a calculator, but a small addition or addon would be extremely helpful. It might even make Paint.net the editor of choice for other Minecraft map makers and I bet it would have other applications as well. Thanks for your time and consideration. Quote Link to comment Share on other sites More sharing options...
pdnnoob Posted June 12, 2016 Share Posted June 12, 2016 This plugin could help: http://forums.getpaint.net/index.php?showtopic=15476 Add a new layer and create a graph with two vertical and two horizontal cells. Adjust the layer blend mode so you can see the map through it. Lines cross in the center. EDIT: it just occurred to me you are looking for coordinates and not just the center. In that case, I don't think a plugin is allowed to tamper with those things. Sorry. EDIT 2: you can try editing your minecraft map with 0,0 in the upper left instead. The absolute value of the coordinates in minecraft will then correspond to the pixel coordinates in Paint.net. You can use command blocks to set the player's spawn point somewhere else if need be. Quote No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo Link to comment Share on other sites More sharing options...
dracho Posted June 12, 2016 Author Share Posted June 12, 2016 Thank you, pdnnoob. Yes, that unfortunately is not quite what I'm after. I do indeed want a Cartesian coordinate display. It doesn't have to replace the existing status bar display... an additional display would be perfectly fine. As far as setting the world's spawn point, I am currently doing this with a mod called PerfectSpawn. It allows me to set the spawn point to a fixed value, and eliminate any "fuzzing" that the game does when a new player spawns. This is only a workaround though, and hopefully a temporary one. Spawn will need to bet set at 0,0 once the map is finished. Also, if I edit other maps with different sizes, I'll have to keep changing the config of PerfectSpawn for testing... then again when I'm ready to playtest it. I'll keep having a look at the Plugins page though. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted June 12, 2016 Share Posted June 12, 2016 How about this: 1. Add a new transparent layer above your map. 2. Mark the center of this layer with the pixel you want to be at (0,0). Use a color easily distinguishable - red in the example below. 3. Activate the rectangle select tool 4. Place the cursor on the newly defined origin and drag out a selection to the destination. The offset will be shown in the tool bar. You will have to mentally add the negative sign yourself Here the destination is (-73, -41) Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
dracho Posted June 12, 2016 Author Share Posted June 12, 2016 Thanks, Ego Eram Reputo! A very solid workaround. I should have thought of that. I've been fighting with the syntax of If/Then statements in Excel to do the calculations... assuming a 5000x5000 image, my syntax was something like "If A1 < 2500, Then A1-2500." It's hurting my brain. (Feel free to comment if you're handy with Excel, too! ) Thanks again. If I can't get this spreadsheet method to work pretty soon, I'll just use your dragging method. Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted June 12, 2016 Share Posted June 12, 2016 I have a script that writes Center-based coordinate points to the canvas. Let me know if you want it.It looks like this: Hidden Content: With a step of 100 Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
dracho Posted June 12, 2016 Author Share Posted June 12, 2016 Thank you, toe_head2001! This is almost exactly what I'm looking for! I assume I can have this added to a layer, so I can turn on and off the visibility, right? I would love to have a play around with this! Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted June 12, 2016 Share Posted June 12, 2016 Here's the CodeLab script: Spoiler // Name: Coordinate Plane // Submenu: Render // Author: toe_head2001 // Title: // Version: 0.1 // Desc: // Keywords: // URL: // Help: #region UICode IntSliderControl Amount1 = 100; // [10,1000] Step #endregion void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); int centerX = ((selection.Right - selection.Left) / 2) + selection.Left; int centerY = ((selection.Bottom - selection.Top) / 2) + selection.Top; int step = Amount1; int horLoops = (int)Math.Ceiling(selection.Width / (float)step); int verLoops = (int)Math.Ceiling(selection.Height / (float)step); int leftEdge = centerX - step * (horLoops / 2); int topEdge = centerY - step * (verLoops / 2); dst.CopySurface(src, rect.Location, rect); using (RenderArgs ra = new RenderArgs(dst)) { Graphics plane = ra.Graphics; plane.TextRenderingHint = TextRenderingHint.AntiAlias; plane.Clip = new Region(rect); using (SolidBrush overlayBrush = new SolidBrush(Color.FromArgb(150, Color.White))) { plane.FillRectangle(overlayBrush, selection); } Point point = new Point(); using (Pen planePen = new Pen(Color.Red, 2)) using (SolidBrush textBrush = new SolidBrush(Color.Black)) using (Font textFont = new Font("Arial", 8, FontStyle.Regular)) { for (int y = 0; y < verLoops; y++) { for (int x = 0; x < horLoops; x++) { point.X = leftEdge + step * x; point.Y = topEdge + step * y; plane.DrawEllipse(planePen, point.X, point.Y, 1, 1); plane.DrawString((point.X - centerX).ToString() + ", " + ((point.Y - centerY) * -1).ToString(), textFont, textBrush, point); } } } } } UPDATE: You can get this plugin in my Plugin Pack. Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
dracho Posted June 12, 2016 Author Share Posted June 12, 2016 (edited) Thanks again, toe_head2001! Fantastic work. I really appreciate it. It was easy to install CodeLab and just as simple to build your script. While I would still love to see an addon developed that simply outputs the Cartesian coordinates of the cursor (as it would be less intrusive and more precise), this script will work perfectly for my application (as I don't need absolute precision and toggling the layer's visibility is trivial to do.) Thank you very much! Edit: P.S. I just edited your code a bit, changing the white overlay translucency from 150 to 0 and now I find it to be even better. Also a very simple adjustment. Very satisfied. Edited June 12, 2016 by dracho Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted June 12, 2016 Share Posted June 12, 2016 P.S. I just edited your code a bit, changing the white overlay translucency from 150 to 0 and now I find it to be even better. Also a very simple adjustment. Very satisfied. If you're going to set it to 0, you might as well just delete that entire code block (those 4 lines). Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
dracho Posted May 4, 2018 Author Share Posted May 4, 2018 Hello, toe_head2001 it's me again. Working on the same project (a few iterations down the road.) I was wondering if it's possible to center 0,0 on the bottom left corner of the image, instead of the center. Thanks again! Quote Link to comment Share on other sites More sharing options...
dracho Posted May 4, 2018 Author Share Posted May 4, 2018 On 6/11/2016 at 9:52 PM, toe_head2001 said: Here's the CodeLab script: Reveal hidden contents // Name: Coordinate Plane // Submenu: Render // Author: toe_head2001 // Title: // Version: 0.1 // Desc: // Keywords: // URL: // Help: #region UICode IntSliderControl Amount1 = 100; // [10,1000] Step #endregion void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); int centerX = ((selection.Right - selection.Left) / 2) + selection.Left; int centerY = ((selection.Bottom - selection.Top) / 2) + selection.Top; int step = Amount1; int horLoops = (int)Math.Ceiling(selection.Width / (float)step); int verLoops = (int)Math.Ceiling(selection.Height / (float)step); int leftEdge = centerX - step * (horLoops / 2); int topEdge = centerY - step * (verLoops / 2); dst.CopySurface(src, rect.Location, rect); using (RenderArgs ra = new RenderArgs(dst)) { Graphics plane = ra.Graphics; plane.TextRenderingHint = TextRenderingHint.AntiAlias; plane.Clip = new Region(rect); using (SolidBrush overlayBrush = new SolidBrush(Color.FromArgb(150, Color.White))) { plane.FillRectangle(overlayBrush, selection); } Point point = new Point(); using (Pen planePen = new Pen(Color.Red, 2)) using (SolidBrush textBrush = new SolidBrush(Color.Black)) using (Font textFont = new Font("Arial", 8, FontStyle.Regular)) { for (int y = 0; y < verLoops; y++) { for (int x = 0; x < horLoops; x++) { point.X = leftEdge + step * x; point.Y = topEdge + step * y; plane.DrawEllipse(planePen, point.X, point.Y, 1, 1); plane.DrawString((point.X - centerX).ToString() + ", " + ((point.Y - centerY) * -1).ToString(), textFont, textBrush, point); } } } } } UPDATE: You can get this plugin in my Plugin Pack. Hello, toe_head2001 it's me again. Working on the same project (a few iterations down the road.) I was wondering if it's possible to center 0,0 on the bottom left corner of the image, instead of the center. Thanks again! Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted May 4, 2018 Share Posted May 4, 2018 35 minutes ago, dracho said: I was wondering if it's possible to center 0,0 on the bottom left corner of the image, instead of the center. Oh sure, that should be easy. I'll work on it tomorrow. Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
toe_head2001 Posted May 4, 2018 Share Posted May 4, 2018 @dracho, how this? Spoiler // Name: Coordinate Plane Points // Submenu: Render // Author: toe_head2001 // Title: // Version: 1.1 // Desc: Generates center-based coordinate plane points // Keywords: // URL: // Help: #region UICode IntSliderControl Amount1 = 100; // [25,1000] Step IntSliderControl Amount2 = 150; // [0,255] Overlay PanSliderControl Amount3 = Pair.Create(0.00,0.000); // Center #endregion void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); Point center = new Point { X = ((selection.Right - selection.Left) / 2) + selection.Left, Y = ((selection.Bottom - selection.Top) / 2) + selection.Top }; Point offset = new Point { X = (int)(center.X + center.X * Amount3.First), Y = (int)(center.Y + center.Y * Amount3.Second) }; int horLoops = (int)Math.Ceiling(selection.Width / (float)Amount1); int verLoops = (int)Math.Ceiling(selection.Height / (float)Amount1); int leftEdge = (offset.X - selection.Left) % Amount1; int topEdge = (offset.Y - selection.Top) % Amount1; dst.CopySurface(src, rect.Location, rect); using (Graphics plane = new RenderArgs(dst).Graphics) { plane.TextRenderingHint = TextRenderingHint.AntiAlias; plane.Clip = new Region(rect); using (SolidBrush overlayBrush = new SolidBrush(Color.FromArgb(Amount2, Color.White))) { plane.FillRectangle(overlayBrush, selection); } Point point = Point.Empty; string pointText; SizeF pointTextSize; using (SolidBrush pointBrush = new SolidBrush(Color.Red)) using (SolidBrush textBrush = new SolidBrush(Color.Black)) using (Font textFont = new Font("Arial", 8, FontStyle.Regular)) { for (int y = 0; y < verLoops; y++) { for (int x = 0; x < horLoops; x++) { point.X = leftEdge + Amount1 * x; point.Y = topEdge + Amount1 * y; plane.FillRectangle(pointBrush, point.X - 1, point.Y - 1, 3, 3); pointText = (point.X - offset.X).ToString() + ", " + ((point.Y - offset.Y) * -1).ToString(); pointTextSize = plane.MeasureString(pointText, textFont); if (pointTextSize.Width >= Amount1) pointText = (point.X - offset.X).ToString() + ",\n" + ((point.Y - offset.Y) * -1).ToString(); plane.DrawString(pointText, textFont, textBrush, point); } } } } } There's a Preview button in CodeLab these days. If you're satisfied with how it works, you can build a DLL file. Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
dracho Posted May 4, 2018 Author Share Posted May 4, 2018 (edited) 27 minutes ago, toe_head2001 said: @dracho, how this? Hide contents // Name: Coordinate Plane Points // Submenu: Render // Author: toe_head2001 // Title: // Version: 1.1 // Desc: Generates center-based coordinate plane points // Keywords: // URL: // Help: #region UICode IntSliderControl Amount1 = 100; // [25,1000] Step IntSliderControl Amount2 = 150; // [0,255] Overlay PanSliderControl Amount3 = Pair.Create(0.00,0.000); // Center #endregion void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); Point center = new Point { X = ((selection.Right - selection.Left) / 2) + selection.Left, Y = ((selection.Bottom - selection.Top) / 2) + selection.Top }; Point offset = new Point { X = (int)(center.X + center.X * Amount3.First), Y = (int)(center.Y + center.Y * Amount3.Second) }; int horLoops = (int)Math.Ceiling(selection.Width / (float)Amount1); int verLoops = (int)Math.Ceiling(selection.Height / (float)Amount1); int leftEdge = (offset.X - selection.Left) % Amount1; int topEdge = (offset.Y - selection.Top) % Amount1; dst.CopySurface(src, rect.Location, rect); using (Graphics plane = new RenderArgs(dst).Graphics) { plane.TextRenderingHint = TextRenderingHint.AntiAlias; plane.Clip = new Region(rect); using (SolidBrush overlayBrush = new SolidBrush(Color.FromArgb(Amount2, Color.White))) { plane.FillRectangle(overlayBrush, selection); } Point point = Point.Empty; string pointText; SizeF pointTextSize; using (SolidBrush pointBrush = new SolidBrush(Color.Red)) using (SolidBrush textBrush = new SolidBrush(Color.Black)) using (Font textFont = new Font("Arial", 8, FontStyle.Regular)) { for (int y = 0; y < verLoops; y++) { for (int x = 0; x < horLoops; x++) { point.X = leftEdge + Amount1 * x; point.Y = topEdge + Amount1 * y; plane.FillRectangle(pointBrush, point.X - 1, point.Y - 1, 3, 3); pointText = (point.X - offset.X).ToString() + ", " + ((point.Y - offset.Y) * -1).ToString(); pointTextSize = plane.MeasureString(pointText, textFont); if (pointTextSize.Width >= Amount1) pointText = (point.X - offset.X).ToString() + ",\n" + ((point.Y - offset.Y) * -1).ToString(); plane.DrawString(pointText, textFont, textBrush, point); } } } } } There's a Preview button in CodeLab these days. Or you can build a DLL file if you're going to be using it a lot. That's awesome! Thanks so much! Really cool how you added that little slider system. I might have been doing something wrong, because the settings didn't seem to affect the code, but I just manually edited the X and Y and opacity after previewing the settings. Maybe that's working as intended. I do have one other request, if you feel like coding a bit more. If not, I'm satisfied! I was hoping you might be able to make the coordinate text white instead of black when it's on top of a dark color. You can see in my screenshot that I prefer 0 overlay opacity (so I can keep the .png color codes precise - this is a template that Minecraft uses to generate terrain) but the text in the water is difficult to read. Thanks, toe_head. Edited May 4, 2018 by dracho added screenshot Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted May 4, 2018 Share Posted May 4, 2018 2 minutes ago, dracho said: I might have been doing something wrong, because the settings didn't seem to affect the code, but I just manually edited the X and Y and opacity after previewing the settings. Maybe that's working as intended. Right, adjusting the UI controls during the Preview doesn't change the code. In other words, you can't change the default values by opening the Preview. That would be very annoying to programmers who are constantly opening Preview to test things after making code changes. 7 minutes ago, dracho said: I was hoping you might be able to make the coordinate text white instead of black when it's on top of a dark color. You want a Toggle (checkbox), or do you want it to automatically set the text color by detecting the light/dark background? Or do want a Color Wheel in the UI, so you can set the text to any color? Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
BoltBait Posted May 5, 2018 Share Posted May 5, 2018 5 hours ago, dracho said: I was hoping you might be able to make the coordinate text white instead of black when it's on top of a dark color. Render your text on it's own layer... in white... change the layer's blend mode to Xor. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game 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.