Article View: comp.sys.amiga.tech
Article #14041Re: Clipping? Questions and recommendations.
From: Ken Farinsky - CATS
Date: Mon, 05 Mar 1990 18:07
Date: Mon, 05 Mar 1990 18:07
89 lines
3677 bytes
3677 bytes
In article <1990Mar3.110330.6134@utu.fi> sutela@utu.fi (Kari Sutela) writes:
>Basically, I'd like to see your opinions on the best method for performing
>clipping. I understand Intuition windows perform clipping automatically. Is
>this true regardless of the window type (SIMPLEREFRESH etc.)?
GimmeZeroZero windows will slow down the whole intuition interface once
you open a few of them. Use the user clip rects, which were added in
1.2. The following is a excerpt from the Addison Wesley RKM, Libs & Devs,
this should work (if I cut it correctly):
Here is some sample code for clipping windows:
/*-----------------------------------------------------------------
** UnclipWindow()
**
** routine to remove a clipping region installed by ClipWindow() or
** ClipWindowToBorders(), disposing of the installed region and
** reinstalling the region removed.
*/
void UnclipWindow(struct Window *win, struct Region *prev_region)
{
register struct Region *old_region ;
/* remove any old region by installing a NULL,
** then dispose of the old region if one was there.
*/
if (NULL != (old_region = InstallClipRegion(win->WLayer, prev_region)))
DisposeRegion(old_region) ;
}
/*-----------------------------------------------------------------
** ClipWindow()
** clip a window to a specified rectangle (given by upper left and
** lower right corner. the removed region is returned so that it
** can be re-installed later.
*/
struct Region *ClipWindow(struct Window *win,
LONG minX, LONG minY, LONG maxX, LONG maxY)
{
register struct Region *new_region ;
register struct Region *old_region ;
struct Rectangle my_rectangle ;
/* set up the limits for the clip */
my_rectangle.MinX = minX ;
my_rectangle.MinY = minY ;
my_rectangle.MaxX = maxX ;
my_rectangle.MaxY = maxY ;
/* get a new region and OR in the limits. */
new_region = NewRegion() ;
OrRectRegion(new_region, &my_rectangle) ;
/* install the new region, and dispose of any existing region */
return(InstallClipRegion(win->WLayer, new_region));
}
/*-----------------------------------------------------------------
** ClipWindowToBorders()
** clip a window to its borders.
** the removed region is returned so that it can be re-installed later.
*/
struct Region *ClipWindowToBorders(struct Window *win)
{
register struct Region *new_region ;
register struct Region *old_region ;
struct Rectangle my_rectangle ;
/* set up the limits for the clip */
my_rectangle.MinX = win->BorderLeft - 1 ;
my_rectangle.MinY = win->BorderTop - 1 ;
my_rectangle.MaxX = win->Width - win->BorderRight ;
my_rectangle.MaxY = win->Height - win->BorderBottom ;
/* get a new region and OR in the limits. */
new_region = NewRegion() ;
OrRectRegion(new_region, &my_rectangle) ;
/* install the new region, and dispose of any existing region */
return(InstallClipRegion(win->WLayer, new_region));
}
--
--------------------------------------------------------------
Ken Farinsky -- CATS Commodore Business Machines
PHONE 215-431-9421 UUCP ...{uunet,rutgers}!cbmvax!ken
--------------------------------------------------------------
Technical Details
Message-ID:
<9993@cbmvax.commodore.com>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!cbmvax!kenReferences:
<1990Mar3.110330.6134@utu.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!cbmvax!ken From: ken@cbmvax.commodore.com (Ken Farinsky - CATS) Newsgroups: comp.sys.amiga.tech Subject: Re: Clipping? Questions and recommendations. Message-ID: <9993@cbmvax.commodore.com> Date: 5 Mar 90 18:07:05 GMT References: <1990Mar3.110330.6134@utu.fi> Reply-To: ken@cbmvax (Ken Farinsky - CATS) Organization: Commodore, West Chester, PA Lines: 89