dillon@CORY.BERKELEY.EDU (Matt Dillon) (12/01/87)
> I am about to deal with the issue of clipping in the > program I am working on, and would like some advice on how > to go about it. I have been told that by using the Layers > Library functions I can do this, but my reading has neither > confirmed nor denied this. > > By clipping I mean that I would like to be able to pass the > drawing functions lines whose endpoints may not be within the All windows created with OpenWindow() automatically use the layers library and clip. The rastport in the screen structure does not use the layers library and thus does not clip. Usually one opens a custom screen, then a backdrop window, rendering into the window. The simple drawing functions will clip completely, but I have found that the more complex ones can't handle x/y values greater than about 4096, so you still need to be a little careful. -Matt
keithd@cadovax.UUCP (Keith Doyle) (12/02/87)
In article <8712010903.AA22789@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes: > All windows created with OpenWindow() automatically use the >layers library and clip. The rastport in the screen structure does not >use the layers library and thus does not clip. Usually one opens a >custom screen, then a backdrop window, rendering into the window. Somehow I don't think this is competely true. I've opened a full screen BORDERLESS | BACKDROP window and used ellipse/circle to render into it, and later found the parts of circles that had extended off screen sitting in other buffers. Not sure just where clipping is done and isn't, but it does lead me to believe it's not automatic on all OpenWindow() windows. Keith Doyle # {ucbvax,decvax}!trwrb!cadovax!keithd Contel Business Systems 213-323-8170
haitex@pnet01.cts.com (Wade Bickel) (12/02/87)
dillon@CORY.BERKELEY.EDU (Matt Dillon) writes: >> I am about to deal with the issue of clipping in the >> program I am working on, and would like some advice on how >> to go about it. I have been told that by using the Layers >> Library functions I can do this, but my reading has neither >> confirmed nor denied this. >> >> By clipping I mean that I would like to be able to pass the >> drawing functions lines whose endpoints may not be within the > > All windows created with OpenWindow() automatically use the >layers library and clip. The rastport in the screen structure does not >use the layers library and thus does not clip. Usually one opens a >custom screen, then a backdrop window, rendering into the window. > > The simple drawing functions will clip completely, but I have >found that the more complex ones can't handle x/y values greater than >about 4096, so you still need to be a little careful. > > -Matt Thanks for the info Matt. Howerver, I am not using intuition. I have tried, and do not believe it is possible for my application. However I still need to incorporate clipping. I have a RastPort already set up, and would like to simply prevent it from drawing out into ?? memory when my points are out of bounds. I do not want to utilize the Layers Library to actually create the Display, as I would like to avoid system copper list management as much as possible. Also, can anyone give me any idea of the processing costs of implementing Layers Lib. clipping. I am working with 3-D images and must clip in Z space anyway. Will the Layers functions be faster/slower than algorithmically croping the images? Thanks again, Wade. UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex ARPA: crash!pnet01!haitex@nosc.mil INET: haitex@pnet01.CTS.COM
cmcmanis%pepper@Sun.COM (Chuck McManis) (12/03/87)
In article <1897@cadovax.UUCP> keithd@cadovax.UUCP (Keith Doyle) writes: > Somehow I don't think this is competely true [that Layers clip] . > I've opened a full screen BORDERLESS | BACKDROP window and used > ellipse/circle to render into it, and later found the parts of circles > that had extended off screen sitting in other buffers. Not sure just > where clipping is done and isn't, but it does lead me to believe it's > not automatic on all OpenWindow() windows. On BIX this was reported as a bug with the AreaEllipse routine. Your TmpRas can get strange stuff in it, and the ellipsi don't clip to the window. I am not sure if Dale signed up to fix it or not, hopefully when he gets a chance he will comment on this as well. I wrote a routine that created an ellipse by calculating it with Bresenhams (sp?) method, converted it to line segments and then used AreaMove/AreaDraw to fill it in. That seems to work correctly. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.
dillon@CORY.BERKELEY.EDU (Matt Dillon) (12/03/87)
> Also, can anyone give me any idea of the processing costs of > implementing Layers Lib. clipping. I am working with 3-D images > and must clip in Z space anyway. Will the Layers functions be > faster/slower than algorithmically croping the images? > > Thanks again, > > Wade. There is a noticeable overhead. The layers lib is setup to handle more general clipping... multiple overlapping windows etc... Also the fact that the library calls use only the lower 16 bits for X,Y positions means that you cannot pass arbitrary 32 bit quantities and assume they will be properly clipped. I suggest you do your own clipping. There are numerous algorithms for clipping more complex objects like polygons. Line clipping is relatively trivial. I think the layer functions would both be slower and inadequate. USING LAYERS TO CLIP: You need to create a layer. Creation of a layer requires a 'base'... A Layer_Info. If using Intuition screens simply use the Screen structure's Layer_Info. Otherwise use the NewLayerInfo() layers.library call. Then use CreateUpfrontLayer() with the screen's Layer_Info and screen's bitmap. Use the layer->rp (the layer's rastport) to render into. -Matt
jimm@amiga.UUCP (12/04/87)
WIndow rastport has layer, and clips always, but not all graphics calls clip. I think Ellipse/Circle are the only ones, think text is OK, but some people believe that your rendering has to be at least ball-park near the window/region. As for not using Intuition, be sure to distinguish between input/interaction roles and output. You might want to open a screen and a backdrop window to get a layer (and LayerInfo) set up, but never use gadgets, IntuiMessages or the like again. It's easier to do this than to figure out LayerInfo stuff. It';s also nice to prototype progs with Intuition, so you can use debug windows, etc. You can fake double-buffer and the whole nine yards. Question was also about Layers vs. Algorithmic Clipping. Well, layers is algorithmic, too, eh? Dale consistently traded ROM space for speed, if that is any comfort. His job was more general than normal, checking for smart refresh and superbitmap on every call, and so on, but, again, it is often nice to put off this part of the puzzle until later. I find that if I tune too much before I start, I don't always finish. Use the easy path, (Grasshopper) and trust your instincts to keep your options open for performance mods. Too bad about ellipses, though. Draw 'em off screen and blit 'em in. Why do I get the feeling that everyone is working on a MacDraw clone? Whose got the hot rounded rect primitive? jimm I and I Computing