2.2 Basic Pict Constructors
procedure
draw : ((is-a?/c dc<%>) real? real? . -> . any) w : real? h : real? (dc draw w h a d) → pict? draw : ((is-a?/c dc<%>) real? real? . -> . any) w : real? h : real? a : real? d : real?
The w and h arguments determine the width and height of the resulting pict’s bounding box. In the three-argument case, the descent is 0 and the ascent is h for the bounding box; in the five-argument case, a and d are used as the bounding box’s ascent and descent.
When the rendering procedure is called, the current pen and brush will be solid and in the pict’s color (and linewidth), and the scale and offset of the drawing context will be set. The text mode will be transparent, but the font and text colors are not guaranteed to be anything in particular.
Example: | |||||||||||||||||||
|
procedure
size : real? = 0 (blank w h) → pict? w : real? h : real? (blank w a d) → pict? w : real? a : real? d : real? (blank w h a d) → pict? w : real? h : real? a : real? d : real?
Example: | ||
|
procedure
content : string? style : text-style/c = null size : (integer-in 1 1024) = 12 angle : real? = 0
The style argument must be one of the following:
null —
the default, same as 'default a font% object
a font family symbol, such a 'roman (see font%)
a font face string, such as "Helvetica" (see font%)
(cons str sym) combining a face string and a font family (in case the face is unavailable; see font%)
(cons 'bold style) for a valid style
(cons 'italic style)
(cons 'subscript style)
(cons 'superscript style)
(cons 'caps style)
(cons 'combine style) —
allows kerning and ligatures (the default, unless the 'modern family is specified) (cons 'no-combine style) —
renders characters individually (cons 'aligned style) —
enables hinting, which rounds metrics to integers (cons 'unaligned style) —
disables hinting (which is the default), so that metrics are scalable (cons color style) —
where color is a color% object, colorizes the text
If both 'combine and 'no-combine are specified, the first one in style takes precedence. Similarly, if both 'aligned and 'unaligned are specified, the first one in style takes precedence. If 'caps is specified, the angle must be zero.
The given size is in pixels, but it is ignored if a font% object is provided in the text-style.
The angle is in radians, and positive values rotate counter-clockwise. For a non-zero angle, the resulting pict’s bounding box covers the rotated text, and the descent is zero and the ascent is the height.
Examples: | ||||||
|
procedure
w : real? h : real? seg-length : (or/c #f real?) = #f (vline w h [#:segment seg-length]) → pict? w : real? h : real? seg-length : (or/c #f real?) = #f
Examples: | ||||
|
procedure
(frame pict [ #:segment seg-length #:color color #:line-width width]) → pict? pict : pict? seg-length : (or/c #f real?) = #f color : (or/c #f string? (is-a?/c color<%>)) = #f width : (or/c #f real?) = #f
Examples: | ||||||
|
procedure
w : real? h : real? (circle diameter) → pict? diameter : real?
(filled-ellipse w h [ #:draw-border? draw-border?]) → pict? w : real? h : real? draw-border? : any/c = #t (disk diameter [#:draw-border? draw-border?]) → pict? diameter : real? draw-border? : any/c = #t
If draw-border? is #f, then the pen is set to be transparent before drawing the ellipse.
Examples: | ||||||||
|
procedure
w : real? h : real?
(filled-rectangle w h [ #:draw-border? draw-border?]) → pict? w : real? h : real? draw-border? : any/c = #t
If draw-border? is #f, then the pen is set to be transparent before drawing the rectangle.
Examples: | ||||
|
procedure
(rounded-rectangle w h [ corner-radius #:angle angle]) → pict? w : real? h : real? corner-radius : real? = -0.25 angle : real? = 0
(filled-rounded-rectangle w h [ corner-radius #:angle angle #:draw-border? draw-border?]) → pict? w : real? h : real? corner-radius : real? = -0.25 angle : real? = 0 draw-border? : any/c = #t
The angle determines how much the rectangle is rotated, in radians.
If draw-border? is #f, then the pen is set to be transparent before drawing the rectangle.
Examples: | ||||
|
procedure
img :
(or/c path-string? (is-a?/c bitmap%) (is-a?/c image-snip%))
If the bitmap cannot be loaded, if the given bitmap% object is not valid, or if the bitmap-draft-mode parameter is set to #t, the result pict draws the word “bitmap failed”.
Examples: | ||||||
|
procedure
dx : real? dy : real? size : real? (pip-arrow-line dx dy size) → pict? dx : real? dy : real? size : real? (pip-arrows-line dx dy size) → pict? dx : real? dy : real? size : real?
The size is used for the arrowhead size. Even though pip-line creates no arrowheads, it accepts the size argument for consistency with the other functions.
procedure
(pin-line pict src find-src dest find-dest [ #:start-angle start-angle #:end-angle end-angle #:start-pull start-pull #:end-pull end-pull #:line-width line-width #:color color] #:alpha alpha [ #:style style #:under? under?]) → pict? pict : pict? src : pict-path? find-src : (pict? pict-path? . -> . (values real? real?)) dest : pict-path? find-dest : (pict? pict-path? . -> . (values real? real?)) start-angle : (or/c real? #f) = #f end-angle : (or/c real? #f) = #f start-pull : real? = 1/4 end-pull : real? = 1/4 line-width : (or/c #f real?) = #f color : (or/c #f string? (is-a?/c color%)) = #f alpha : (real-in 0.0 1.0)
style :
(one-of/c 'transparent 'solid 'xor 'hilite 'dot 'long-dash 'short-dash 'dot-dash 'xor-dot 'xor-long-dash 'xor-short-dash 'xor-dot-dash) = 'solid under? : any/c = #f
(pin-arrow-line arrow-size pict src find-src dest find-dest [ #:start-angle start-angle #:end-angle end-angle #:start-pull start-pull #:end-pull end-pull #:line-width line-width #:color color] #:alpha alpha [ #:style style #:under? under? #:solid? solid?] #:hide-arrowhead? any/c) → pict? arrow-size : real? pict : pict? src : pict-path? find-src : (pict? pict-path? . -> . (values real? real?)) dest : pict-path? find-dest : (pict? pict-path? . -> . (values real? real?)) start-angle : (or/c real? #f) = #f end-angle : (or/c real? #f) = #f start-pull : real? = 1/4 end-pull : real? = 1/4 line-width : (or/c #f real?) = #f color : (or/c #f string? (is-a?/c color%)) = #f alpha : (real-in 0.0 1.0)
style :
(one-of/c 'transparent 'solid 'xor 'hilite 'dot 'long-dash 'short-dash 'dot-dash 'xor-dot 'xor-long-dash 'xor-short-dash 'xor-dot-dash) = 'solid under? : any/c = #f solid? : any/c = #t any/c : #f
(pin-arrows-line arrow-size pict src find-src dest find-dest [ #:start-angle start-angle #:end-angle end-angle #:start-pull start-pull #:end-pull end-pull #:line-width line-width #:color color] #:alpha alpha #:style style [ #:under? under? #:solid? solid?] #:hide-arrowhead? any/c) → pict? arrow-size : real? pict : pict? src : pict-path? find-src : (pict? pict-path? . -> . (values real? real?)) dest : pict-path? find-dest : (pict? pict-path? . -> . (values real? real?)) start-angle : (or/c real? #f) = #f end-angle : (or/c real? #f) = #f start-pull : real? = 1/4 end-pull : real? = 1/4 line-width : (or/c #f real?) = #f color : (or/c #f string? (is-a?/c color%)) = #f alpha : (real-in 0.0 1.0)
style :
(one-of/c 'transparent 'solid 'xor 'hilite 'dot 'long-dash 'short-dash 'dot-dash 'xor-dot 'xor-long-dash 'xor-short-dash 'xor-dot-dash) under? : any/c = #f solid? : any/c = #t any/c : #f
If under? is true, then the line and arrows are added under the existing pict drawing, instead of on top. If solid? is false, then the arrowheads are hollow instead of filled.
The start-angle, end-angle, start-pull, and end-pull arguments control the curve of the line (and the defaults produce a straight line):
The start-angle and end-angle arguments specify the direction of curve at its start and end positions; if either is #f, it defaults to the angle of a straight line from the start position to end position.
The start-pull and end-pull arguments specify a kind of momentum for the starting and ending angles; larger values preserve the angle longer.
The line-width, color, alpha, and style arguments apply to the added line.
When the hide-arrowhead? argument is a true value, then space for an arrowhead is kept around the line, but the arrowhead itself is not drawn.
Examples: | ||||||||||||||||||||||||||||||||||||
|
value
parameter
(bitmap-draft-mode on?) → void? on? : any/c