home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18522 < prev    next >
Encoding:
Text File  |  1993-01-11  |  2.3 KB  |  73 lines

  1. Path: sparky!uunet!usc!cs.utexas.edu!sun-barr!rutgers!cbmvax!davidj
  2. From: davidj@cbmvax.commodore.com (David N. Junod)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Regions and BOOPSI gadgets?
  5. Message-ID: <38469@cbmvax.commodore.com>
  6. Date: 11 Jan 93 19:08:38 GMT
  7. References: <S37732V.93Jan8183438@lk-hp-20.hut.fi>
  8. Reply-To: davidj@cbmvax.commodore.com (David N. Junod)
  9. Distribution: comp
  10. Organization: Commodore, West Chester, PA
  11. Lines: 60
  12.  
  13. s37732v@snakemail.hut.fi (Markus Juhani Aalto) writes:
  14. >
  15. >Hi!
  16. >
  17. >I've been programming a gadtools listview replacement with BOOPSI gadgets
  18. >and it worked alright until I started to use Regions to clip my drawing
  19. >to the rastport. I currently InstallClipRegion when I get GM_RENDER
  20. >message and do my rendering after that. This works fine when I open
  21. >the gadgets but after I size the window all clipping goes absolutely
  22. >out of control. So is there a possible way to use Regions in BOOPSI
  23. >gadgets? 
  24. >
  25. >I think that the problem is with InstallClipRegion routine used
  26. >between Refreshing because of window sizing. I just can't imagine any
  27. >other way to do clipping properly and fast.
  28.  
  29. Here's a fragment from one of my boopsi objects that installs a clipping
  30. region while rendering.
  31.  
  32. struct Region *
  33. installclipregion (struct Window *w, struct Layer *l, struct Region *r)
  34. {
  35.     BOOL refresh = FALSE;
  36.     struct Region *or;
  37.  
  38.     if (w->Flags & WINDOWREFRESH)
  39.     {
  40.     EndRefresh (w, FALSE);
  41.     refresh = TRUE;
  42.     }
  43.     or = InstallClipRegion (l, r);
  44.     if (refresh)
  45.     BeginRefresh (w);
  46.     return (or);
  47. }
  48.  
  49. LONG
  50. renderMethod (Class *cl, Object *o, struct gpRender *msg)
  51. {
  52.     struct Window *win = msg->gpr_GInfo->gi_Window;
  53.     struct objectData *od = INST_DATA (cl, o);
  54.     struct Rectangle rect;
  55.     struct Region *or;
  56.  
  57.     /* ... your region is created in OM_NEW and deleted in OM_DISPOSE */
  58.     ClearRegion (od->od_Region);
  59.     /* Fill in the rectangle structure here...*/
  60.     /* In 3.x and beyond, you can set up the region in GM_LAYOUT instead
  61.      * of every single GM_RENDER call */
  62.     OrRectRegion (od->od_Region, &rect);
  63.     or = installclipregion (win, msg->gpr_RPort->Layer, od->od_Region);
  64.  
  65.     /* do your rendering in here... */
  66.  
  67.     installclipregion (win, msg->gpr_RPort->Layer, or);
  68. }
  69.  
  70. >*         Markus Aalto              | Helsinki University of Technology  *
  71.  
  72. ~DNJ~
  73.