LWChris Posted October 5, 2023 Share Posted October 5, 2023 A 20x20 rounded rectangle with border width 1 and corner radius 4 looks like this: For some reason, 3 out of 4 corners get a "different" version of how a rounded corner looks like; only the top right seems to be actually 4x4. This is what radius 5 looks like: None of these corners have a 5x5 footprint. Here's radius 6: You get the idea... I tested all values from 1 to 10, and none of these values resulted in a symmetrical shape. I'm not sure it has always been like this, or if that's a regression, but something's odd about the rounding here, resulting in that I effectively cannot use this tool unless I want to check and tidy up 3 or all 4 corners, which may be feasible for radii up to 8, but beyond that it's very cumbersome. Quote Link to comment Share on other sites More sharing options...
Tactilis Posted October 5, 2023 Share Posted October 5, 2023 See this related thread. Same issue. https://forums.getpaint.net/topic/114910-weird-circle/ Quote Link to comment Share on other sites More sharing options...
BoltBait Posted October 5, 2023 Share Posted October 5, 2023 Paint.NET uses Direct2D for drawing primitives. So, take this up with Microsoft. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
LWChris Posted October 6, 2023 Author Share Posted October 6, 2023 19 hours ago, BoltBait said: Paint.NET uses Direct2D for drawing primitives. So, take this up with Microsoft. Okay, so from what I have read here, the issue seems to be that PDN is using Direct2D for drawing shapes, and while the antialiased version are good, the aliased geometry is poor and that causes the problem. What's really interesting is that this only happens at thickness 1. Thickness 2 seems to be symmetrical for non-rotated shapes. Quote Link to comment Share on other sites More sharing options...
LWChris Posted October 7, 2023 Author Share Posted October 7, 2023 I have created a proof of concept for a custom renderer that handles circles, ellipses, and rounded rectangles. There is not yet any ability to rotate a shape and to be fair that is something I haven't even gotten around to think about. @Rick Brewster I published the code under MIT license. If you want to take a look, or use my code (or the "thickness = 1" bits) as base for your own custom renderer that you have not gotten around to since 2010, feel free. Also, if you want me to strip the code to only the "thickness = 1" case first, and/or want to see inclusion of rotations as well, please let me know. 1 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 9, 2023 Share Posted October 9, 2023 I'll add the link to the github issue where I'm tracking this -- who knows, I may get around to it Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 9, 2023 Share Posted October 9, 2023 On 10/5/2023 at 8:25 AM, BoltBait said: Paint.NET uses Direct2D for drawing primitives. So, take this up with Microsoft. For 1-px brush width, without antialiasing, I use my own renderer because Direct2D does a bad job there. So there's precedent for something like this. Every time I've looked at this problem, it just was not simple to solve despite seeming like it should be. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
BoltBait Posted October 9, 2023 Share Posted October 9, 2023 6 minutes ago, Rick Brewster said: Every time I've looked at this problem, it just was not simple to solve despite seeming like it should be. Render 1/4 of the shape (upper left), mirror and flip? Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 9, 2023 Share Posted October 9, 2023 That’s the trivially easy part. Implementing a generalized, comprehensive solution for the rest of it is the hard part. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
LWChris Posted October 9, 2023 Author Share Posted October 9, 2023 (edited) 9 hours ago, BoltBait said: Render 1/4 of the shape (upper left), mirror and flip? That's also how I do it in the PoC. What I find difficult about this is - how would you implement rotation? Because for a rotated ellipse for example, "top left" of input can't be "easily" reflected (or at least I wouldn't trust that mathematical calculations of reflected pixels about a randomly slanted symmetry axis will never ever create a result with a gap in the outline), and for output the "top left" isn't enough and also potentially not a rectangle. Sadly, I noticed it's not necessarily limited to 1px outlines if you consider rotation. This is how a 34x11 ellipsis with border thickness 2 looks like when rotated exactly 90°: While doing this example, I also noticed that in PDN, the outline of ellipses grow symmetrically around the set size. E. g. for a 20x20 rectangle with border thickness 6, all border pixels lie within that 20x20 (the fill is 8x8). But switch to ellipse, and now 3 pixels are inside, 3 are outside, meaning the resulting shape is actually 26x26 in size. However don't think changing that to a consistent behavior (where I prefer the rectangle one) would be detrimental to anyone (except for that one person drawing ellipses using an AutoHotkey macro on a daily basis). [Edit: I now realized that "rectangle" and "rounded rectangle" are the outliers here; all other shapes grow symmetrically around the set size, only those two grow within. I still like the rectangle's behavior better, because it preserves size while changing outline thickness or form fill mode from to ] Edited October 9, 2023 by LWChris Quote Link to comment Share on other sites More sharing options...
BoltBait Posted October 9, 2023 Share Posted October 9, 2023 3 hours ago, LWChris said: how would you implement rotation? Render top left to a buffer. From that, draw full shape to buffer. In a separate step, rotate buffer to image using nearest neighbor. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 10, 2023 Share Posted October 10, 2023 22 hours ago, BoltBait said: Render top left to a buffer. From that, draw full shape to buffer. In a separate step, rotate buffer to image using nearest neighbor. No, that would produce awful results Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
BoltBait Posted October 10, 2023 Share Posted October 10, 2023 1 hour ago, Rick Brewster said: No, that would produce awful results I’ll just be quiet now. 😂 1 Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free 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.