2.7 More Pict Constructors
2.7.1 Dingbats
w : real? |
h : real? |
Creates a fluffy cloud.
w : real? |
h : real? |
shaded? : any/c = #f |
Creates a Mac-like file icon, optionally shaded. If color is not a string or color% object, it is treated as a boolean, in which case true means "gray" and false means "white".
| ||||||||||||||||||||||||||||||||||||||||||
w : real? | ||||||||||||||||||||||||||||||||||||||||||
h : real? | ||||||||||||||||||||||||||||||||||||||||||
direction : (one-of/c 'left 'right) = 'left | ||||||||||||||||||||||||||||||||||||||||||
eye-color : (or/c string? (is-a?/c color%) false/c) = "black" | ||||||||||||||||||||||||||||||||||||||||||
Creates a fish swimming either 'left or 'right. If eye-color is #f, no eye is drawn.
The open-mouth argument can be either #f (mouth closed), #t (mouth fully open), or a number: 0.0 is closed, 1.0 is fully open, and numbers in between are partially open.
| |||||||||||||||||||||
size : real? | |||||||||||||||||||||
Creates a jack-o-lantern; use the same pumpkin and face color to get a plain pumpkin. The size determines the width.
(angel-wing w h left?) → pict? |
w : real? |
h : real? |
left? : any/c |
Creates an angel wing, left or right, or any size. The color and pen width for drawing the wing outline is the current one.
2.7.2 Balloon Annotations
The slideshow/balloon library provides functions for creating and placing cartoon-speech balloons.
| ||||||||||||||||||||||||||||||||||||||||||
pict : pict? | ||||||||||||||||||||||||||||||||||||||||||
spike : (one-of/c ('n 's 'e 'w 'ne 'se 'sw 'nw)) | ||||||||||||||||||||||||||||||||||||||||||
dx : real? | ||||||||||||||||||||||||||||||||||||||||||
dy : real? | ||||||||||||||||||||||||||||||||||||||||||
color : (or/c string? (is-a?/c color%)) = balloon-color | ||||||||||||||||||||||||||||||||||||||||||
Superimposes pict on top of a balloon that wraps it.
The spike argument indicates the corner from which a spike protrudes from the balloon (i.e., the spike that points to whatever the balloon is about). For example, 'n means “north,”, which is a spike in the top middle of the balloon.
The dx and dy arguments specify how far the spike should protrude. For a 'w spike, dx should be negative, etc.
The color argument is the background color for the balloon.
The corner-radius argument determines the radius of the cicle used to roun the balloon’s corners. As usual, if it is less than 1, then it acts as a ratio of the balloon’s width or height.
The result is a balloon, not a pict. The balloon-pict function extracts a pict whose bounding box does not include the spike, but includes the rest of the image, and the balloon-point-x and balloon-point-y functions extract the location of the spike point. More typically, the pin-balloon function is used to add a balloon to a pict.
| ||||||||||||||||||||||||||||||||||||||||||
pict : pict? | ||||||||||||||||||||||||||||||||||||||||||
spike : (one-of/c ('n 's 'e 'w 'ne 'se 'sw 'nw)) | ||||||||||||||||||||||||||||||||||||||||||
dx : real? | ||||||||||||||||||||||||||||||||||||||||||
dy : real? | ||||||||||||||||||||||||||||||||||||||||||
color : (or/c string? (is-a?/c color%)) = balloon-color | ||||||||||||||||||||||||||||||||||||||||||
Like wrap-balloon, but produces a zero-sized pict suitable for use with pin-over.
(pin-balloon balloon base x y) → pict? |
balloon : balloon? |
base : pict? |
x : real? |
y : real? |
(pin-balloon balloon base at-pict find) → pict? |
balloon : balloon? |
base : pict? |
at-pict : pict-path? |
Superimposes the pict in balloon onto base to produce a new pict. The balloon is positioned so that its spike points to the location specified by either x and y (numbers) or at the position determined by combining base and at-pict with find. The find function uses its arguments like lt-find.
The resulting pict has the same bounding box, descent, and ascent as base, even if the balloon extends beyond the bounding box.
w : real? |
h : real? |
spike : (one-of/c ('n 's 'e 'w 'ne 'se 'sw 'nw)) |
dx : real? |
dy : real? |
color : (or/c string? (is-a?/c color%)) = balloon-color |
Creates a balloon, much like wrap-balloon except that the balloon’s width is w and its height is h.
v : any/c |
(make-balloon pict x y) → balloon? |
pict : pict? |
x : real? |
y : real? |
(balloon-pict balloon) → pict? |
balloon : balloon? |
(balloon-point-x balloon) → real? |
balloon : balloon? |
(balloon-point-y balloon) → real? |
balloon : balloon? |
A balloon encapsulates a pict and the position of the balloon’s spike relative to the balloon’s top-left corner.
balloon-color : (or/c string? (is-a?/c color%)) |
The default background color for a balloon.
2.7.3 Face
The slideshow/face library provides functions for a kind of Mr. Potatohead-style face library.
Orange.
mood : symbol? |
color : (or/c string (is-a?/c color%)) = default-face-color |
Returns a pict for a pre-configured face with the given base color. The built-in configurations, selected by mood-symbol, are as follows:
'unhappy – (face* 'none 'plain #t default-face-color 6)
'sortof-unhappy – (face* 'worried 'grimace #t default-face-color 6)
'sortof-happy – (face* 'worried 'medium #f default-face-color 6)
'happy – (face* 'none 'plain #f default-face-color 6)
'happier – (face* 'none 'large #f default-face-color 3)
'embarrassed – (face* 'worried 'medium #f default-face-color 3)
'badly-embarrassed – (face* 'worried 'medium #t default-face-color 3)
'unhappier – (face* 'normal 'large #t default-face-color 3)
'happiest – (face* 'normal 'huge #f default-face-color 0 -3)
'unhappiest – (face* 'normal 'huge #t default-face-color 0 -3)
'mad – (face* 'angry 'grimace #t default-face-color 0)
'mean – (face* 'angry 'narrow #f default-face-color 0)
'surprised – (face* 'worried 'oh #t default-face-color -4 -3 2)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
eyebrow-kind : (one-of/c 'none 'normal 'worried 'angry) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
frown? : any/c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
eye-inset : real? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
eyebrow-dy : real? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pupil-dx : real? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pupil-dy : real? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
eyebrow-on? : any/c = #t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mouth-on? : any/c = #t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
eye-on? : any/c = #t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tongue-on? : any/c = #t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
face-bg-on? : any/c = #t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
teeth-on? : any/c = #t |
Returns a pict for a face:
eyebrow-kind determines the eyebrow shape.
mouth-kind determines the mouth shape, combined with frown?.
frown? determines whether the mouth is up or down.
color determines the face color.
eye-inset adjusts the eye size; recommend values are between 0 and 10.
eyebrow-dy adjusts the eyebrows; recommend values: between -5 and 5.
pupil-dx adjusts the pupil; recommend values are between -10 and 10.
pupil-dy adjusts the pupil; recommend values are between -15 and 15.
The #:eyebrow-shading? through #:face-background-shading? arguments control whether a shading is used for on a particular feature in the face (shading tends to look worse than just anti-aliasing when the face is small). The #:teeth? argument controls the visibility of the teeth for some mouth shapes.
2.7.4 Flash
| |||||||||||||||||||||||||||||||||||
width : real? | |||||||||||||||||||||||||||||||||||
height : real? | |||||||||||||||||||||||||||||||||||
n-points : exact-positive-integer? = 10 | |||||||||||||||||||||||||||||||||||
spike-fraction : (real-in 0 1) = 0.25 | |||||||||||||||||||||||||||||||||||
rotation : real? = 0 |
Returns a pict for a “flash”: a spiky oval, like the yellow background that goes behind a “new!” logo on web pages or a box of cereal.
The height and width arguments determine the size of the oval in which the flash is drawn, prior to rotation. The actual height and width may be smaller if points is not a multiple of 4, and the actual height and width will be different if the flash is rotated.
The n-points argument determines the number of points on the flash.
The spike-fraction argument determines how big the flash spikes are compared to the bounding oval.
The rotation argument specifies an angle in radians for counter-clockwise rotation.
The flash is drawn in the default color.
| |||||||||||||||||||||||||||||||||||
width : real? | |||||||||||||||||||||||||||||||||||
height : real? | |||||||||||||||||||||||||||||||||||
n-points : exact-positive-integer? = 10 | |||||||||||||||||||||||||||||||||||
spike-fraction : (real-in 0 1) = 0.25 | |||||||||||||||||||||||||||||||||||
rotation : real? = 0 |
Like filled-flash, but drawing only the outline.