[comp.sys.amiga] Clipping within a window.

peter@sugar.UUCP (Peter DaSilva) (06/19/87)

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?

-- Peter da Silva (why doesn't VI do SLOWOPEN on vt100s?)

gary@eddie.MIT.EDU (Gary Samad) (06/24/87)

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?
}
}-- Peter da Silva (why doesn't VI do SLOWOPEN on vt100s?)

You can simply use GZZ, you don't need the superbitmap to simply do clipping
within the borders of the window.

	Gary

rap@dana.UUCP (Rob Peck) (06/26/87)

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?
> 
> -- Peter da Silva (why doesn't VI do SLOWOPEN on vt100s?)

Use the layers.library routine to create a layer in your current window.
There is an example in the ROM Kernel manual that draws the words
"Behind a fence" literally behind a fence.  (I wrote that example).

You can use layers to position arbitrary clipping rectangles in a window.

Rob Peck.

bryce@COGSCI.BERKELEY.EDU (06/27/87)

In article <186@dana.UUCP> rap@dana.UUCP (Rob Peck) writes:
>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?
>> 
>Use the layers.library routine to create a layer in your current window.
>There is an example in the ROM Kernel manual that draws the words
>"Behind a fence" literally behind a fence.  (I wrote that example).

-(Nice example, BTW)-

---------
In this case I believe that peter wants to do a SIMPLE_REFRESH console
device replacement. (for CLI windows and such)
---------
*IF* this is what's going on, that would be a poor way to do things:

Since console devices are required to count the size of the window in
characters, and don't work (well) with proportional characters, the 
clipping rectangle would be mostly extra baggage.

A "console device" would want to clip to the nearest whole character, and
in most cases wrap it to the next line. (unless, of course, <CSI>?7l
is in effect.  <CSI>?7h turns wrap on again.  <CSI> can also be expressed
with <ESC>[ )

Simply count characters (you'll need to anyway) and don't trash your
borders.  Possibly use the "WarpText" routines that someone recently
presented to comp.sources.amiga to crank your update rates up. (I
have not tried WarpText, and know next-to-nothing about the operation
of layers or damage lists, so don't take my word for it)

kinner@wsucshp.UUCP (Bill Kinnersley ) (06/27/87)

  
  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?

Do as follows:

struct Rectangle rect = {10, 10, 100, 100} /* or whatever */
struct Window *win;
struct Region *reg;

reg = NewRegion();
OrRectRegion(reg, &rect);
InstallClipRegion(win->WLayer, reg);

---
"Nesting is for the birds"
                --Bill Kinnersley
    USENET: ...!ucbvax!ucdavis!egg-id!ui3!wsucshp!kinner
    INTERNET: kinner%wsu@RELAY.CS.NET
    CSNET: kinner@cs1.wsu.edu
    MAIL: CS Dept, Washington State Univ, Pullman WA 99164-1210
    PHONE: (509)332-3340

scott@applix.UUCP (Scott Evernden) (06/28/87)

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

peter@sugar.UUCP (Peter DaSilva) (07/12/87)

In article <186@dana.UUCP>, rap@dana.UUCP (Rob Peck) writes:
> > [my question about getting clipping inside windows]
> Use the layers.library routine to create a layer in your current window.
> There is an example in the ROM Kernel manual that draws the words
> "Behind a fence" literally behind a fence.  (I wrote that example).

Won't that interfere with the existing clipping rectangle's I'm rendering
through anyway... that is, the list that excludes other windows that might
be overlapping mine?
-- 
-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter (I said, NO PHOTOS!)

peter@sugar.UUCP (Peter DaSilva) (07/12/87)

> In this case I believe that peter wants to do a SIMPLE_REFRESH console
> device replacement. (for CLI windows and such)

That's one of the things I want to do.

> *IF* this is what's going on, that would be a poor way to do things:
> 
> Since console devices are required to count the size of the window in
> characters, and don't work (well) with proportional characters, the 
> clipping rectangle would be mostly extra baggage.

But one of the features that I'm working on (to be implemented in a terminal
program first) is the ability to have the window pan over a larger display
area... like a Superbitmap window, but for text. This will allow you to have
a smaller than 80 by 24 window, but still use vi... currently not possible
on the workbench window unless you're using morerows. In this case I'll want
to keep partial characters.

> A "console device" would want to clip to the nearest whole character, and
> in most cases wrap it to the next line. (unless, of course, <CSI>?7l
> is in effect.  <CSI>?7h turns wrap on again.  <CSI> can also be expressed
> with <ESC>[ )

Only if it's an ANSI console device (ANSI:). I'll also want to have an ADM3A:,
and maybe a 4027:.

> Simply count characters (you'll need to anyway) and don't trash your
> borders.  Possibly use the "WarpText" routines that someone recently
> presented to comp.sources.amiga to crank your update rates up. (I
> have not tried WarpText, and know next-to-nothing about the operation
> of layers or damage lists, so don't take my word for it)

I haven't recieved WarpText, or any of a large number of recent posts.
-- 
-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter (I said, NO PHOTOS!)