DIRECTORY GGCoreTypes, Imager, ImagerTransformation; GGBoundBox: CEDAR DEFINITIONS = BEGIN BoundBox: TYPE = GGCoreTypes.BoundBox; Point: TYPE = Imager.VEC; Vector: TYPE = Imager.VEC; emptyBoundBox: BoundBox; -- [loX, loY: LargestNumber, hiX, hiY: SmallestNormalizedNumber] CreateBoundBox: PROC [loX, loY, hiX, hiY: REAL, null: BOOL ¬ FALSE, infinite: BOOL ¬ FALSE] RETURNS [bBox: BoundBox]; NullBoundBox: PROC [] RETURNS [bBox: BoundBox]; CopyBoundBox: PROC [bBox: BoundBox] RETURNS [copy: BoundBox]; BoundBoxOfBoxes: PROC [list: LIST OF BoundBox] RETURNS [bigBox: BoundBox]; BoundBoxOfBoundBox: PROC [box: BoundBox, transform: ImagerTransformation.Transformation] RETURNS [newBox: BoundBox]; BoundBoxFromRectangle: PROC [rect: Imager.Rectangle] RETURNS [bBox: BoundBox]; RectangleFromBoundBox: PROC [bBox: BoundBox] RETURNS [rect: Imager.Rectangle]; BoundBoxOfPixelArray: PROC [pa: Imager.PixelArray] RETURNS [bBox: BoundBox]; BoundBoxOfBitMap: PROC [base: LONG POINTER, wordsPerLine: NAT, sMin, fMin, sSize, fSize: NAT, tx, ty: INTEGER ¬ 0] RETURNS [bBox: BoundBox]; EnlargeByBox: PROC [bBox: BoundBox, by: BoundBox]; EnlargeByPoint: PROC [bBox: BoundBox, point: Point]; EnlargeByVector: PROC [bBox: BoundBox, vector: Vector]; EnlargeByOffset: PROC [bBox: BoundBox, offset: REAL]; UpdateBoundBox: PROC [bBox: BoundBox, loX, loY, hiX, hiY: REAL]; UpdateBoundBoxOfBoundBox: PROC [bBox: BoundBox, localBox: BoundBox, transform: ImagerTransformation.Transformation]; UpdateCopyBoundBox: PROC [bBox: BoundBox, from: BoundBox]; PointIsInBox: PROC [test: Point, box: GGCoreTypes.BoundBoxObj] RETURNS [BOOL]; PointIsInGrownBox: PROC [test: Point, box: BoundBox, offset: REAL] RETURNS [BOOL]; Centroid: PROC [box: BoundBox] RETURNS [centroid: Point, success: BOOL]; EraseWithinBoundBox: PROC [dc: Imager.Context, bBox: BoundBox]; Clip: PROC [dc: Imager.Context, bBox: BoundBox]; MaskArray: TYPE = ARRAY[0..4) OF BOOL; NearestPoint: PROC [bBox: BoundBox, testPoint: Point, tolerance: REAL ¬ 1E6, mask: MaskArray ¬ ALL[TRUE]] RETURNS [bestDist: REAL, bestJoint: NAT, bestPoint: Point, success: BOOL]; NearestSegment: PROC [bBox: BoundBox, testPoint: Point, tolerance: REAL ¬ 1E6, mask: MaskArray ¬ ALL[TRUE]] RETURNS [bestDist: REAL, bestSeg: NAT, bestPoint: Point, success: BOOL]; END. ή GGBoundBox.mesa Copyright Σ 1985, 1992 by Xerox Corporation. All rights reserved. Last edited by Bier on July 16, 1987 7:36:17 pm PDT Contents: Procedures for creating and combining bounding boxes for refresh efficiency. Pier, May 22, 1987 10:32:22 am PDT Kurlander August 23, 1986 5:08:14 pm PDT Bier, May 2, 1989 7:22:28 pm PDT Routines that create a new BoundBox. Computes a bounding box in units of screen dots for the given pixel array. The lower left corner will be [0,0]. Computes a bounding box in units of screen dots for the given bit map. The lower left corner will be [0,0]. Routines that modify an existing BoundBox. Update bBox to be the bounding box of itself and itself offset by vector. Useful to take drop shadows into account, for instance. Enlarges bBox to include a border of width offset around bBox. Useful to allow for stroke width of a segment, for instance. Modifies the numerical fields of bBox. Information Derived from a BoundBox Returns TRUE if test is contained within box. Operates on BoundBoxObj (which is presumably on the execution stack). Returns TRUE if test is contained within [box.loX-offset, box.loY-offset, box.hiX+offset, box.hiY+offset]. Drawing BoundBoxes. Hit Testing BoundBoxes. Κc•NewlineDelimiter –(cedarcode) style™code™Kšœ Οeœ6™BKšœ3™3KšΟnœO™WKšœΟk™"Kšœ%Ÿ™(K™ K™—šŸ ˜ Kšœ*˜*K˜—Kšž œŸœŸ œ˜KšŸ˜˜Kšœ Ÿœ˜&KšœŸœ Ÿœ˜KšœŸœ Ÿœ˜—K˜KšœΟc@˜YK˜Kšœ$™$K™KšžœŸœŸœŸœŸœ ŸœŸœŸœ˜uKšž œŸœŸœ˜/Kšž œŸœŸœ˜=Kš žœŸœŸœŸœ Ÿœ˜JKšžœŸœAŸœ˜tKšžœŸœŸœ˜NKšžœŸœŸœ˜NšžœŸœŸœ˜LK™p—šžœŸœŸœŸœŸœŸœ ŸœŸœ˜K™lK™—K™Kšœ*™*K™Kšž œŸœ ˜2KšžœŸœ ˜4šžœŸœ"˜7K™‚—šžœŸœŸœ˜5Kšœ|™|—KšžœŸœ&Ÿœ˜@KšžœŸœV˜tšžœŸœ"˜:Kšœ&™&—K˜K™#K™šž œŸœ-ŸœŸœ˜NKšœ-™-KšœE™E—š žœŸœ&ŸœŸœŸœ˜RKšœŸœ^™j—šžœŸœŸœŸœ˜HK˜—˜Kšœ™—K™KšžœŸœ&˜?KšžœŸœ&˜0˜Kšœ™—Kš œ ŸœŸœŸœŸœ˜&Kšž œŸœ/ŸœŸœŸœŸœ Ÿœ ŸœŸœ˜΄KšžœŸœ/ŸœŸœŸœŸœ Ÿœ ŸœŸœ˜΄K˜KšŸœ˜K˜—…—ς3