[comp.os.os2.programmer] Drawing & Clipping

rimola@solrac.metaphor.com (Carlos Rimola) (08/25/90)

A basic (I hope) PM question:

I have an analog clock application that experiences a clipping peculiarity
when it is partly overlayed by a dialog or a pull down menu.  eg:

	+-------+
	|\   	| (1)
  (2) +======+	|
      +======+	|
	|   \	|
	+-------+

(1) is the main window, (2) is a dialog that is partly overlaying the
window, the "\" symbols represent a line that is partly overlayed by
the dialog.  The problem is that often the drawing that takes place outside
of the overlayed area (outside not under it) is incorrect.  eg:      

	1) draw a line
	2) overlay window with a dialog, partly covering the line
	3) erase the line by redrawing it using the background color
	4) remove the dialog 

At the end of this operation I end up with the line partly erased, the
portion under the dialog is correct but that portion not covered by the
dialog is not.  eg:

	+-------+
	|\   	| 
  	|	|
      	|	|
	|   \	|
	+-------+

Can someone explain why this is happening and what can be done to fix it?

ie15@vaxb.acs.unt.edu (09/01/90)

In article <1385@metaphor.Metaphor.COM>, rimola@solrac.metaphor.com (Carlos Rimola) writes:
> A basic (I hope) PM question:
> 
> I have an analog clock application that experiences a clipping peculiarity
> when it is partly overlayed by a dialog or a pull down menu.  eg:
> 
> 	+-------+
> 	|\   	| (1)
>   (2) +======+	|
>       +======+	|
> 	|   \	|
> 	+-------+
> 
> (1) is the main window, (2) is a dialog that is partly overlaying the
> window, the "\" symbols represent a line that is partly overlayed by
> the dialog.  The problem is that often the drawing that takes place outside
> of the overlayed area (outside not under it) is incorrect.  eg:      
> 
> 	1) draw a line
> 	2) overlay window with a dialog, partly covering the line
> 	3) erase the line by redrawing it using the background color
> 	4) remove the dialog 
> 
> At the end of this operation I end up with the line partly erased, the
> portion under the dialog is correct but that portion not covered by the
> dialog is not.  eg:
> 
> 	+-------+
> 	|\   	| 
>   	|	|
>       	|	|
> 	|   \	|
> 	+-------+
> 
> Can someone explain why this is happening and what can be done to fix it?

It depends on how you're getting your PS. If it's during the WM_PAINT you get
after the dialog is moved it is working as designed, probably, since PM
will give you a PS that has a clipping boundry defined by the invalidated
rectange of your window. Therefore your got the PS from WinBeginPaint() and
drew the line. It even worked. But since the clipping rectangle is only 
the size of the dialog box that was over your window the bottom and the bottom
segments of the line were not drawn. Does anybody agree with me?

Ken Tabor
UNT
                                                     

rimola@solrac.metaphor.com (Carlos Alberto Rimola) (09/06/90)

In article <33586.26dfdb60@vaxb.acs.unt.edu- ie15@vaxb.acs.unt.edu writes:
-In article <1385@metaphor.Metaphor.COM>, rimola@solrac.metaphor.com (Carlos Rimola) writes:
-> A basic (I hope) PM question:
-> 
-> I have an analog clock application that experiences a clipping peculiarity
-> when it is partly overlayed by a dialog or a pull down menu.  eg:
-> 
-> 	+-------+
-> 	|\   	| (1)
->   (2) +======+	|
->       +======+	|
-> 	|   \	|
-> 	+-------+
-> 
-> (1) is the main window, (2) is a dialog that is partly overlaying the
-> window, the "\" symbols represent a line that is partly overlayed by
-> the dialog.  The problem is that often the drawing that takes place outside
-> of the overlayed area (outside not under it) is incorrect.  eg:      
-> 
-> 	1) draw a line
-> 	2) overlay window with a dialog, partly covering the line
-> 	3) erase the line by redrawing it using the background color
-> 	4) remove the dialog 
-> 
-> At the end of this operation I end up with the line partly erased, the
-> portion under the dialog is correct but that portion not covered by the
-> dialog is not.  eg:
-> 
-> 	+-------+
-> 	|\   	| 
->   	|	|
->       	|	|
-> 	|   \	|
-> 	+-------+
-> 
-> Can someone explain why this is happening and what can be done to fix it?
-
-It depends on how you're getting your PS. If it's during the WM_PAINT you get
-after the dialog is moved it is working as designed, probably, since PM
-will give you a PS that has a clipping boundry defined by the invalidated
-rectange of your window. Therefore your got the PS from WinBeginPaint() and
-drew the line. It even worked. But since the clipping rectangle is only 
-the size of the dialog box that was over your window the bottom and the bottom
-segments of the line were not drawn. Does anybody agree with me?
-
-Ken Tabor
-UNT
-                                                     

I agree with you.  I went ahead and put in a WinGetPS call in addition to
WinBegPaint and proceeded to perform my drawing operations using the PS 
handle returned by WinGetPS and the clipping problem went away.

I am still a bit confused by how clipping works during a WM_PAINT and
why I have not been able to find a discussion of it in the 1.2 PM documents.
I am also unsure that the method that I am using to bypass clipping is
the correct one to use in this situation.