5 Bounding Box Adjusters
procedure
pict : pict-convertible? amt : real? (inset pict h-amt v-amt) → pict? pict : pict-convertible? h-amt : real? v-amt : real? (inset pict l-amt t-amt r-amt b-amt) → pict? pict : pict-convertible? l-amt : real? t-amt : real? r-amt : real? b-amt : real?
Extends pict’s bounding box by adding the given amounts
to the corresponding sides; ascent and descent are extended, too.
Examples:
> (pict-width (disk 40)) 40
> (pict-width (inset (disk 40) -10)) 20
procedure
(clip-descent pict) → pict?
pict : pict-convertible?
Truncates pict’s bounding box by removing the descent part.
Examples:
procedure
(clip-ascent pict) → pict?
pict : pict-convertible?
Truncates pict’s bounding box by removing the ascent part.
Examples:
procedure
(lift-bottom-relative-to-baseline p baseline [ #:extend-bb? bb?]) → pict? p : pict-convertible? baseline : real? bb? : any/c = #f
Lift the image in p such that the
bottom of the picture is baseline above its
baseline.
If bb? is #f then the bounding box
is unchanged, otherwise it is adjusted to fit the resulting pict.
Examples:
> (define shift 10) > (explain (lift-bottom-relative-to-baseline t shift)) > (explain (lift-bottom-relative-to-baseline t shift #:extend-bb? #t)) > (explain (lift-bottom-relative-to-baseline tt shift)) > (explain (lift-bottom-relative-to-baseline tt shift #:extend-bb? #t)) > (explain (lift-bottom-relative-to-baseline t (- shift))) > (explain (lift-bottom-relative-to-baseline t (- shift) #:extend-bb? #t)) > (explain (lift-bottom-relative-to-baseline tt (- shift))) > (explain (lift-bottom-relative-to-baseline tt (- shift) #:extend-bb? #t))
Added in version 1.10 of package pict-lib.
procedure
(drop-top-relative-to-ascent p ascent [ #:extend-bb? bb?]) → pict? p : pict-convertible? ascent : real? bb? : any/c = #f
Lift the image in p such that the
top of the picture is ascent below its
ascent.
If bb? is #f then the bounding box
is unchanged, otherwise it is adjusted to fit the resulting pict.
Examples:
> (define shift 10) > (explain (drop-top-relative-to-ascent t shift)) > (explain (drop-top-relative-to-ascent t shift #:extend-bb? #t)) > (explain (drop-top-relative-to-ascent tt shift)) > (explain (drop-top-relative-to-ascent tt shift #:extend-bb? #t)) > (explain (drop-top-relative-to-ascent t (- shift))) > (explain (drop-top-relative-to-ascent t (- shift) #:extend-bb? #t)) > (explain (drop-top-relative-to-ascent tt (- shift))) > (explain (drop-top-relative-to-ascent tt (- shift) #:extend-bb? #t))
Added in version 1.10 of package pict-lib.
procedure
(lift-above-baseline pict amt) → pict?
pict : pict-convertible? amt : real?
For backwards compatibility. Use lift-bottom-relative-to-baseline instead.
Lifts pict relative to its baseline, extending the bounding box height if necessary.
Examples:
> (explain (hbl-append (text "ijijij" null 12) (text "abc" null 12))) > (inset (explain (lift-above-baseline (text "ijijij" null 12) 20)) 0 100 0 50)
> (explain (hbl-append (lift-above-baseline (text "ijijij" null 12) 20) (text "abc" null 12)))
procedure
(drop-below-ascent pict amt) → pict?
pict : pict-convertible? amt : real?
For backwards compatibility. Use drop-top-relative-to-ascent instead.
Drops pict relative to its ascent line, extending the bounding box height if necessary.
Examples:
> (define txt (text "ijgy" null 12)) > (explain (hbl-append txt (text "abc" null 12))) > (explain (drop-below-ascent txt 12))
> (explain (hbl-append (drop-below-ascent txt 12) (text "abc" null 12)))
procedure
pict : pict-convertible?
Makes the descent 0 and the ascent the same as the height.
Examples:
> (explain (hbl-append (text "gjy" null 12) (text "abc" null 12)))
> (explain (hbl-append (baseless (text "gjy" null 12)) (text "abc" null 12)))
procedure
pict : pict-convertible? sub-pict : pict-convertible?
Assuming that sub-pict can be found within pict,
shifts the overall bounding box to that of sub-pict (but
preserving all the drawing of pict). The last element, as
reported by pict-last is also set to (or (pict-last sub-pict) sub-pict).
Examples:
> (define p1 (filled-rectangle 50 50 #:color "darkkhaki")) > (define p2 (filled-rectangle 30 30 #:color "sienna")) > (define combined (cc-superimpose p1 p2)) > combined > (refocus combined p2)
procedure
pict : pict-convertible?
Shifts the given pict’s bounding box to enclose the bounding boxes of
all sub-picts (even laundered picts).
Examples:
> (define p1 (filled-rectangle 50 50 #:color "maroon")) > (define p2 (disk 30 #:color "tomato")) > (define combined (cc-superimpose p1 p2)) > (refocus combined p2) > (panorama (refocus combined p2))
procedure
pict : pict-convertible? sub-pict : pict-path?
Returns a pict like pict, but with the last element (as
reported by pict-last) set to sub-pict. The
sub-pict must exist as a sub-pict (or path of sub-picts)
within pict.
procedure
pict : pict-convertible? sub-pict : pict-convertible?
Propagates the last element of sub-pict to pict.
That is, use-last* is like use-last, but the last
element of sub-pict is used as the new last element for
pict, instead of sub-pict itself—