Jump to content


Photo

Paste Problem


12 replies to this topic

#1 BoltBait

BoltBait

    2013 Movie Guru Award Winner

  • Administrators
  • 9,604 posts
  • LocationCalifornia, USA
  • Reputation:314

Posted 04 February 2011 - 09:06 PM

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.
  • 0
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#2 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,579 posts
  • LocationKirkland, WA
  • Reputation:328

Posted 05 February 2011 - 01:26 AM

How did you create the initial 78x30 selection?
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image

#3 BoltBait

BoltBait

    2013 Movie Guru Award Winner

  • Administrators
  • 9,604 posts
  • LocationCalifornia, USA
  • Reputation:314

Posted 05 February 2011 - 02:51 AM

By using the square selection tool. Nothing fancy there. I used :RectangleSelectTool: then :MoveSelectionTool: 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.
  • 0
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#4 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,579 posts
  • LocationKirkland, WA
  • Reputation:328

Posted 05 February 2011 - 03:22 AM

Were you zoomed in? Zoomed out?
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image

#5 BoltBait

BoltBait

    2013 Movie Guru Award Winner

  • Administrators
  • 9,604 posts
  • LocationCalifornia, USA
  • Reputation:314

Posted 05 February 2011 - 03:25 AM

I was zoomed in to 300% or 400% on the source image.
  • 0
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#6 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,579 posts
  • LocationKirkland, WA
  • Reputation:328

Posted 05 February 2011 - 04:00 AM

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.
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image

#7 BoltBait

BoltBait

    2013 Movie Guru Award Winner

  • Administrators
  • 9,604 posts
  • LocationCalifornia, USA
  • Reputation:314

Posted 05 February 2011 - 04:03 AM

I'm just glad I could help.
  • 0
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#8 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,579 posts
  • LocationKirkland, WA
  • Reputation:328

Posted 08 February 2011 - 02:58 AM

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?
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image

#9 BoltBait

BoltBait

    2013 Movie Guru Award Winner

  • Administrators
  • 9,604 posts
  • LocationCalifornia, USA
  • Reputation:314

Posted 08 February 2011 - 04:13 AM

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.
  • 0
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#10 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,579 posts
  • LocationKirkland, WA
  • Reputation:328

Posted 08 February 2011 - 04:32 AM

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 #.
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image

#11 BoltBait

BoltBait

    2013 Movie Guru Award Winner

  • Administrators
  • 9,604 posts
  • LocationCalifornia, USA
  • Reputation:314

Posted 08 February 2011 - 05:31 PM

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?
  • 0
Click to play:
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image
Download: BoltBait's Plugin Pack | CodeLab | More... and how about a Computer Dominos Game

#12 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,579 posts
  • LocationKirkland, WA
  • Reputation:328

Posted 09 February 2011 - 06:27 AM

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.
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image

#13 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,579 posts
  • LocationKirkland, WA
  • Reputation:328

Posted 12 February 2011 - 07:07 PM

This is fixed in the v3.5.7 update.
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image