A window and its associated presentation space have three regions that control where drawing takes place in the window. These regions ensure that the application does not draw outside the boundaries of the window or intrude into the space of an overlapping window.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³Region ³Description ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Update Region ³This region represents the area of the window³ ³ ³that needs to be redrawn. This region changes³ ³ ³when overlapping windows change their z-order³ ³ ³or when an application explicitly adds an ³ ³ ³area to the update region to force a window ³ ³ ³to be painted. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Clip Region ³This region and the visible region determine ³ ³ ³where drawing takes place. Applications can ³ ³ ³change the clip region to limit drawing to a ³ ³ ³particular portion of a window. Typically, a ³ ³ ³presentation space is created with a clip ³ ³ ³region equal to NULL, which makes this region³ ³ ³equivalent to the update region. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Visible Region ³This region and the clip region determine ³ ³ ³where drawing takes place. The system changes³ ³ ³the visible region to represent the portion ³ ³ ³of a window that is visible. Typically, the ³ ³ ³visible region is used to mask out ³ ³ ³overlapping windows. When an application ³ ³ ³calls the WinBeginPaint function in response ³ ³ ³to a WM_PAINT message, the system sets the ³ ³ ³visible region to the intersection of the ³ ³ ³visible region and the update region to ³ ³ ³produce a new visible region. Applications ³ ³ ³cannot change the visible region directly. ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙWhenever drawing occurs in a window's presentation space, the output is clipped to the intersection of the visible region and clip region.
The clip region includes the overlapped part of the back window, but the visible region excludes that portion of the back window. The system maintains the visible region to protect other windows on the screen; the application maintains the clip region to specify the portion of the window in which it draws. Together, these two regions provide safe and controllable clipping.
To further control drawing, both the system and the application manipulate the update region. For example, if a window's position is switched from back to front, positions front to back, several changes occur in the regions of both windows. The system adds the lower-right corner of the new front window to that window's visible region. The system also adds that corner area to the window's update region.