On this page:
inset
clip-descent
clip-ascent
lift-bottom-relative-to-baseline
drop-top-relative-to-ascent
lift-above-baseline
drop-below-ascent
baseless
refocus
panorama
use-last
use-last*

5 Bounding Box Adjusters🔗ℹ

procedure

(inset pict amt)  pict?

  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:
> (explain (text "gjy" null 12))

image

> (explain (clip-descent (text "gjy" null 12)))

image

procedure

(clip-ascent pict)  pict?

  pict : pict-convertible?
Truncates pict’s bounding box by removing the ascent part.

Examples:
> (explain (text "gjy" null 12))

image

> (explain (clip-ascent (text "gjy" null 12)))

image

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))

image

> (explain (lift-bottom-relative-to-baseline t shift #:extend-bb? #t))

image

> (explain (lift-bottom-relative-to-baseline tt shift))

image

> (explain (lift-bottom-relative-to-baseline tt shift #:extend-bb? #t))

image

> (explain (lift-bottom-relative-to-baseline t (- shift)))

image

> (explain (lift-bottom-relative-to-baseline t (- shift) #:extend-bb? #t))

image

> (explain (lift-bottom-relative-to-baseline tt (- shift)))

image

> (explain (lift-bottom-relative-to-baseline tt (- shift) #:extend-bb? #t))

image

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))

image

> (explain (drop-top-relative-to-ascent t shift #:extend-bb? #t))

image

> (explain (drop-top-relative-to-ascent tt shift))

image

> (explain (drop-top-relative-to-ascent tt shift #:extend-bb? #t))

image

> (explain (drop-top-relative-to-ascent t (- shift)))

image

> (explain (drop-top-relative-to-ascent t (- shift) #:extend-bb? #t))

image

> (explain (drop-top-relative-to-ascent tt (- shift)))

image

> (explain (drop-top-relative-to-ascent tt (- shift) #:extend-bb? #t))

image

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)))

image

> (inset (explain (lift-above-baseline (text "ijijij" null 12) 20)) 0 100 0 50)

image

> (explain (hbl-append (lift-above-baseline (text "ijijij" null 12) 20)
                       (text "abc" null 12)))

image

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)))

image

> (explain (drop-below-ascent txt 12))

image

> (explain (hbl-append (drop-below-ascent txt 12)
                       (text "abc" null 12)))

image

procedure

(baseless pict)  pict?

  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)))

image

> (explain (hbl-append (baseless (text "gjy" null 12))
                       (text "abc" null 12)))

image

procedure

(refocus pict sub-pict)  pict?

  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

image

> (refocus combined p2)

image

procedure

(panorama pict)  pict?

  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)

image

> (panorama (refocus combined p2))

image

procedure

(use-last pict sub-pict)  pict?

  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

(use-last* pict sub-pict)  pict?

  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—unless (pict-last sub-pict) is #f, in which case sub-pict is used as the last element of pict.