home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!cs.utexas.edu!sun-barr!rutgers!cbmvax!davidj
- From: davidj@cbmvax.commodore.com (David N. Junod)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Regions and BOOPSI gadgets?
- Message-ID: <38469@cbmvax.commodore.com>
- Date: 11 Jan 93 19:08:38 GMT
- References: <S37732V.93Jan8183438@lk-hp-20.hut.fi>
- Reply-To: davidj@cbmvax.commodore.com (David N. Junod)
- Distribution: comp
- Organization: Commodore, West Chester, PA
- Lines: 60
-
- s37732v@snakemail.hut.fi (Markus Juhani Aalto) writes:
- >
- >Hi!
- >
- >I've been programming a gadtools listview replacement with BOOPSI gadgets
- >and it worked alright until I started to use Regions to clip my drawing
- >to the rastport. I currently InstallClipRegion when I get GM_RENDER
- >message and do my rendering after that. This works fine when I open
- >the gadgets but after I size the window all clipping goes absolutely
- >out of control. So is there a possible way to use Regions in BOOPSI
- >gadgets?
- >
- >I think that the problem is with InstallClipRegion routine used
- >between Refreshing because of window sizing. I just can't imagine any
- >other way to do clipping properly and fast.
-
- Here's a fragment from one of my boopsi objects that installs a clipping
- region while rendering.
-
- struct Region *
- installclipregion (struct Window *w, struct Layer *l, struct Region *r)
- {
- BOOL refresh = FALSE;
- struct Region *or;
-
- if (w->Flags & WINDOWREFRESH)
- {
- EndRefresh (w, FALSE);
- refresh = TRUE;
- }
- or = InstallClipRegion (l, r);
- if (refresh)
- BeginRefresh (w);
- return (or);
- }
-
- LONG
- renderMethod (Class *cl, Object *o, struct gpRender *msg)
- {
- struct Window *win = msg->gpr_GInfo->gi_Window;
- struct objectData *od = INST_DATA (cl, o);
- struct Rectangle rect;
- struct Region *or;
-
- /* ... your region is created in OM_NEW and deleted in OM_DISPOSE */
- ClearRegion (od->od_Region);
- /* Fill in the rectangle structure here...*/
- /* In 3.x and beyond, you can set up the region in GM_LAYOUT instead
- * of every single GM_RENDER call */
- OrRectRegion (od->od_Region, &rect);
- or = installclipregion (win, msg->gpr_RPort->Layer, od->od_Region);
-
- /* do your rendering in here... */
-
- installclipregion (win, msg->gpr_RPort->Layer, or);
- }
-
- >* Markus Aalto | Helsinki University of Technology *
-
- ~DNJ~
-