Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!bu-cs!m2c!applix!scott From: scott@applix.UUCP (Scott Evernden) Newsgroups: comp.sys.amiga Subject: Re: Clipping within a window. Message-ID: <536@applix.UUCP> Date: Sat, 27-Jun-87 22:12:31 EDT Article-I.D.: applix.536 Posted: Sat Jun 27 22:12:31 1987 Date-Received: Sun, 28-Jun-87 05:00:23 EDT References: <205@sugar.UUCP> <186@dana.UUCP> Reply-To: scott@applix.UUCP (Scott Evernden) Organization: APPLiX Inc., Westboro MA Lines: 51 In article <205@sugar.UUCP>, peter@sugar.UUCP (Peter DaSilva) writes: > I want to clip some text (or graphic) output to within the borders of a > simplerefresh window. What's the best way to do this? I know I can use > superbitmap with GZZ, but that's rather overkill for text only output. > That is, I guess, how do I set up a clipping rectangle of my own within a > window? The following frags are pulled from one code skeleton I sometimes use: It uses the (great) new 1.2 Layers function 'InstallClipRegion()'. struct Region *region; /* region to describe clipping area/region */ struct Rectangle rect; /* help for building 'region' clipping area */ struct Window *w; /* our window; if necessary, use Andy Finkel's code to get from console */ struct Layer *layer; /* gets ptr to our window's layer */ long LayersBase; /* we'll be using this library */ . . . /* Early, as part of your init code */ LayersBase = (long) OpenLibrary("layers.library", 33L); region = NewRegion(); /* Assuming your window is 'w': */ layer = w->RPort->Layer; /* Form the clipping rectangle region */ rect.MinX = MINX; /* your choice */ rect.MinY = MINY; rect.MaxX = MAXX; rect.MaxY = MAXY; OrRectRegion(region, &rect); . . . /* To use this clipping rectangle: */ InstallClipRegion(layer, region); . . . /* Before the 'w' window gets closed! */ InstallClipRegion(layer, (struct Region *) NULL); /* necessary cleanup */ DisposeRegion(region); CloseLibrary(LayersBase); Hope this is helpful! -scott