This problem is something I don't seem to be able to wrap my head around. It's not an error or anything, it's just that my mind doesn't seem to let me find a suitable way to do this.
What I am trying to do is, first, based on some coordinate data, the code generates a list of rectangles, all within the screen's bounds. This first part is fine, no problems here.
But now, what I want to do next, is to get all the rectangles of the portions of the screen that was not used by the first list.
An example, assuming that the resolution is 1920x1080 and we have one rectangle in the first list with the following data:
x = 600, y = 240, width = height = 64
The rectangles that should be generated in the second list should cover the remaining portions of the screen, thus the list should contain:
Rect1: x = 0, y = 0, width = 1920, height = 600
Rect2: x = 0, y = 240, width = 600, height = 840
Rect3: x = 664, y = 240, width = 1256, height = 840
Rect4: x = 600, y = 304, width = 600, height = 776
(This was taken from rough assumption, I reckon these should fill the remaining portions)
- The rectangles that fill the screen must NOT overlap a single pixel of the rectangles in the first list.
- Every pixel of the screen must be covered in rectangles from either the first or the second list.
- The first list can contain anything from none to 500 rectangles. So it must be dynamic.
Any help on this?
Thanks in advance.