[comp.windows.news] getbbox operator

dennis@dennis.colorado.edu (02/03/90)

The Openwindows code is using a new, apparently undocumented
operator called getbbox.
It signature seems to be this:
	canvas bool => x y w h
where at least the w and h depend on the current scale.
Can anyone enlighten me as to the semantics of getbbox?

-Dennis Heimbigner
(dennis@boulder.colorado.edu)

naughton@wind.Sun.COM (Patrick Naughton) (02/06/90)

>>> The Openwindows code is using a new, apparently undocumented
>>> operator called getbbox.
>>> It signature seems to be this:
>>>         canvas bool => x y w h
>>> where at least the w and h depend on the current scale.
>>> Can anyone enlighten me as to the semantics of getbbox?
>>> -Dennis Heimbigner
>>> (dennis@boulder.colorado.edu)

I'm not sure why it wasn't documented, but here's what it does:

canvas|string true => llx lly urx ury
canvas|string false => llx lly w h

These return the bounding box of the canvas or string in the current
ctm.  The 'false' case simply does the subtraction of the lower-left
from the upper-right and returns the width and height, suitable for
passing to 'rectpath'.

PS> /cv framebuffer newcanvas def
PS> 0 0 100 200 rectpath cv reshapecanvas
PS> 300 400 cv movecanvas
PS> cv false getbbox pstack clear
300.0 400.0 100.0 200.0
PS> cv setcanvas
PS> cv false getbbox pstack clear
0.0 0.0 100.0 200.0
PS> (Hello) false getbbox pstack clear
0.0 0.0 34.0 9.0

-Patrick
    ______________________________________________________________________
    Patrick J. Naughton				    ARPA: naughton@sun.com
    Window Systems Group			    UUCP: ...!sun!naughton
    Sun Microsystems, Inc.			    AT&T: (415) 336 - 1080

rxb@ASC.SLB.COM (Rafael Bracho) (02/07/90)

The (undocumented) getbbox operator has the following syntax:

	object bool GETBBOX => x y x' y'

where 'object' may be a string or a canvas.  It will return the bounding
box of the object in one of two forms:  If 'bool' is true, the result is
a "rect" (i.e., x' and y' are width and height, respectively), else, the
result is a "bbox" (i.e., x' and y' are the corners of the upper-right
corner, like in the 'pathbbox' operator).

					-Rafael