Archived

This topic is now archived and is closed to further replies.

Yoonjae

Drawing overlapping windows with no overdraw in GUI system

Recommended Posts

For example, two overlapping windows is given like this :
*---------------*
|               |
|               |
|       *---------------*
|       |               |
|       |               |
|       |               |
|       |               |
*-------|               |
        |               |
        |               |
        *---------------*
To draw them with no overdraw, I wanna split them like this :
*------**-------*
|      ||       |
*------**-------*
*------**-------**------*
|      ||       ||      |
|      ||       ||      |
|      ||       ||      |
|      ||       ||      |
*------**-------**------*
        *-------**------*
        |       ||      |
        *-------**------*
Is there any efficient algorithm for this? Or is there another algorithm that doesn't use splitting? [edited by - Yoonjae on August 12, 2002 1:41:47 AM] [edited by - Yoonjae on August 12, 2002 1:43:05 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
To find the overlapping area (or to find out if there is one), check:

if( min( rect1.top, rect2.top ) > max( rect1.bottom, rect2.bottom )
&&
min( rect1.right, rect2.right ) > max( rect1.left, rect2.left ) )

then there is an overlap.

If you assign the results (just replace all min(..top...) with (top = min(..top...)) inside all ifs) then you have the overlapping reigon. From that you can find all of the smaller rectangles.

Karg

Share this post


Link to post
Share on other sites
Finding overlapping region is easy.
But splitting method shown in above picture is another problem.
I wanna know splitting algorithm that works efficiently in regardless of # of windows.

Share this post


Link to post
Share on other sites