10 Shadows
(require pict/shadow) | package: pict-lib |
These pict transformations add shadows or blurring in various shapes and forms.
procedure
p : pict? h-radius : (and/c real? (not/c negative?)) v-radius : (and/c real? (not/c negative?)) = h-radius
(* (pict-width p) (pict-height p))
Added in version 1.4 of package pict-lib.
procedure
(shadow p radius [ dx dy #:color color #:shadow-color shadow-color]) → pict? p : pict? radius : (and/c real? (not/c negative?)) dx : real? = 0 dy : real? = dx color : (or/c #f string? (is-a?/c color%)) = #f shadow-color : (or/c #f string? (is-a?/c color%)) = #f
If color is not #f, the foreground part is (colorize p color); otherwise it is just p. If shadow-color is not #f, the shadow part is produced by blurring (colorize p shadow-color); otherwise it is produced by blurring p.
The resulting pict has the same bounding box as p.
> (inset (shadow (text "shadow" null 50) 10) 10) > (inset (shadow (text "shadow" null 50) 10 5) 10)
> (inset (shadow (text "shadow" null 50) 5 0 2 #:color "white" #:shadow-color "red") 10)
Added in version 1.4 of package pict-lib.
procedure
(shadow-frame pict ... [ #:sep separation #:margin margin #:background-color bg-color #:frame-color frame-color #:frame-line-width frame-line-width #:shadow-side-length shadow-side-length #:shadow-top-y-offset shadow-top-y-offset #:shadow-bottom-y-offset shadow-bottom-y-offset #:shadow-descent shadow-descent #:shadow-alpha-factor shadow-alpha-factor #:blur blur-radius]) → pict? pict : pict? separation : real? = 5 margin : real? = 20 bg-color : (or/c string? (is-a?/c color%)) = "white" frame-color : (or/c string? (is-a?/c color%)) = "gray" frame-line-width : (or/c real? #f 'no-frame) = 0 shadow-side-length : real? = 4 shadow-top-y-offset : real? = 10 shadow-bottom-y-offset : real? = 4 shadow-descent : (and/c real? (not/c negative?)) = 40 shadow-alpha-factor : real? = 3/4 blur-radius : (and/c real? (not/c negative?)) = 20
The picts are vertically appended with separation space between them. They are placed on a rectangular background of solid bg-color with margin space on all sides. A frame of frame-color and frame-line-width is added around the rectangle, unless frame-line-width is 'no-frame. The rectangle casts a shadow that extends shadow-side-length to the left and right, starts shadow-top-y-offset below the top of the rectangle and extends to shadow-bottom-y-offset below the bottom of the rectangle in the center and an additional shadow-descent below that on the sides. The shadow is painted using a linear gradient; shadow-alpha-factor determines its density at the center. Finally, the shadow is blurred by blur-radius; all previous measurements are pre-blur measurements.
> (shadow-frame (text "text in a nifty frame" null 60))
Added in version 1.4 of package pict-lib.