0

I'm wanting to set up an area on my screen for a screen capture using ReadPixels but I'm unsure how the pixel space coordinates. Based on a 825 x 825 pixel square that is 215 pixels from the left and 134 pixels up from the bottom. How would I enter that in to ReadPixels parameters. I've entered my guess in the line below. Is that correct or does y need to be negative?

TmpTexture2D.ReadPixels(new Rect(215, 134, 1040, 959), 0, 0, false);

enter image description here

greyBow
  • 1,298
  • 3
  • 28
  • 62
  • What are you capturing? You can use `RenderTexture` and get the entire rendered image. – user1767754 Nov 28 '17 at 04:22
  • Well I have a coloring book application that allows a user to draw and I only want to capture that particular area. – greyBow Nov 28 '17 at 04:23
  • You can get the bound's of your points (i assume you are using a 2D Camera) and use that bounds as a rect to crop the image. – user1767754 Nov 28 '17 at 04:27
  • Just added a diagram to better illustrate – greyBow Nov 28 '17 at 04:28
  • I was previously capturing my entire screen using `TmpTexture2D.ReadPixels(new Rect(0, 0, RenderTextureSize.x, RenderTextureSize.y), 0, 0, false);` but I only need to capture an area and the application will always be running at a 1280x1024 screen resolution. – greyBow Nov 28 '17 at 04:29
  • As i understand you are drawing onto a texture? Do you want the user to draw a `rectangle` to get the region or are you trying to come up with a `heuristic` that it automatically should detect `painted` and `non-painted` areas? – user1767754 Nov 28 '17 at 04:38
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/159955/discussion-between-greybow-and-user1767754). – greyBow Nov 28 '17 at 04:39

0 Answers0