BoltBait Posted February 4, 2011 Share Posted February 4, 2011 I opened a new graphic today using Paint.NET 3.5.6. I had just flattened an image. Then, I selected a middle portion of the graphic 78x30 pixels, adjusted what was selected with the move selection tool, and pressed Ctrl-C. Then I immediately pressed Ctrl-Alt-V to paste into a new image. The resulting image was 79x30 with an extra column of transparent pixels down the right edge. Still looking at the new image, I pressed Ctrl-V to paste what was on the clipboard again... this time it came out right: the image was fully selected and the line of transparent pixels was not selected. I hit the crop button to fix the new graphic and all was well. I was cutting out buttons from a big image and creating individual button images. This happened twice in a row (the first two buttons) then did not happen for the third or fourth. Starting the next row, it happened again. It is not happening every time, and sometimes the extra row of pixels is at the bottom. Does it depend on what edge was adjusted last using the move selection tool? I'm on Windows XP. Enjoy. 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...
Rick Brewster Posted February 5, 2011 Share Posted February 5, 2011 How did you create the initial 78x30 selection? 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 February 5, 2011 Author Share Posted February 5, 2011 By using the square selection tool. Nothing fancy there. I used then to fine tune what was selected, then Ctrl-C. I find it interesting that there was a size difference between the Ctrl-V paste and the Ctrl-Alt-V paste. I would start by comparing code in those areas. 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...
Rick Brewster Posted February 5, 2011 Share Posted February 5, 2011 Were you zoomed in? Zoomed out? 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 February 5, 2011 Author Share Posted February 5, 2011 I was zoomed in to 300% or 400% on the source image. 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...
Rick Brewster Posted February 5, 2011 Share Posted February 5, 2011 Okay I know I fixed a few issues with discrepancies between selection and Paste, but apparently there are a few more. I'll file a bug for v3.5.x. Thanks. 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 February 5, 2011 Author Share Posted February 5, 2011 I'm just glad I could help. 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...
Rick Brewster Posted February 8, 2011 Share Posted February 8, 2011 I'm going to take a guess here: using the Move Selection tool, you adjusted a corner edge while holding down the shift key. Does that sound right? 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 February 8, 2011 Author Share Posted February 8, 2011 I might have. I think I was adjusting the size of the selection using the middle handles. It's been a while and I don't remember. Plus, that system crashed and I'm rebuilding it. I had one hard drive fail... of a raid 0 striped volume. On the plus side, your usage graph for next period will have one less Windows 2003 Server user in it and one more Windows 2008 Server user in it. 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...
Rick Brewster Posted February 8, 2011 Share Posted February 8, 2011 What I found is that the selection geometry object, which tracks things using double-precision floating point, is drifting by a tiny amount. In this case that I'm looking at right now, the bounds are x=360.0, y=263.99999999999994 (thirteen 9's and a 4), width=60.0, height=16.901408450704253. All the code is correct from a mathematical standpoint, but that drift is what's causing an "extra" pixel on the edge. In this case it's on the top edge, on your's it was on the bottom. Windows 7 and Server 2008 get lumped together. They have the same version #. 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 February 8, 2011 Author Share Posted February 8, 2011 Everything I've seen with Ctrl-V and Shift-Ctrl-V paste works fine. The problem is in Ctrl-Alt-V. When you press Ctrl-Alt-V, Paint.NET creates a new canvas to contain the clipboard contents before the normal Ctrl-V paste happens. In this case, the Ctrl-V part works fine, but the Ctrl-Alt-V part creates a canvas that is too big. My guess is that there is a rounding error happening in the Ctrl-Alt-V code that creates a new canvas. Brain storm: Are you using the same rounding techniques, in the same way? Are the data types different? Is a cast (or automatic cast) causing this? 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...
Rick Brewster Posted February 9, 2011 Share Posted February 9, 2011 What's happening is a discrepancy between the geometry's bounding box, and the bounding box of the geometry's scan-conversion. The geometry is, essentially, a System.Windows.Point[][]. That is, a list of double-precision (X,Y) pairs. A list of polygons. The scan-conversion is the System.Windows.Int32Rect[] that approximates the interior of the polygon for a particular transformation (or rather, "at a specific resolution"). The geometry bounds end up being something like top=, 293.999999994. The scan-conversion correctly has a bound of 294. In order to ensure that all pixels come along for the ride, the MaskedSurface class takes the Int32Bound of the geometry bounds -- which gives us top=293. (the "Int32Bound" of a Rect is simply "the smallest rectangle, using integer coordinates, that fits around this rectangle which uses floating point coordinates"). And then the PasteInToNewImage action is taking the size of that rectangle instead of the bounds of the scan-conversion. 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 February 12, 2011 Share Posted February 12, 2011 This is fixed in the v3.5.7 update. 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...
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.