2.9 Rendering

► |  | Slideshow: Figure and Presentation Tools

1 | Creating Slide Presentations
2 | Making Pictures
3 | Making Slides
4 | Typesetting Racket Code
5 | Animations
| Bibliography
| Index

▼ | 2 | Making Pictures

2.1 | Pict Datatype
2.2 | Basic Pict Constructors
2.3 | Pict Combiners
2.4 | Pict Drawing Adjusters
2.5 | Bounding Box Adjusters
2.6 | Pict Finders
2.7 | More Pict Constructors
2.8 | Miscellaneous
2.9 | Rendering
2.10 | Conversion to Picts

On this page:

dc-for-text-size
draw-pict
pict->bitmap
make-pict-drawer
show-pict
current-expected-text-scale

top ← prev up next →

#### 2.9`` Rendering

> parameter (dc-for-text-size) → (or/c #f (is-a?/c dc<%>))
> (dc-for-text-size dc) → void?
> dc : (or/c #f (is-a?/c dc<%>))

A parameter that is used to determine the bounding box of picts created with text.

The drawing context installed in this parameter need not be the same as the ultimate drawing context, but it should measure text in the same way. Under normal circumstances, font metrics are the same for all drawing contexts, so the default value of dc-for-text-size is a bitmap-dc% that draws to a 1-by-1 bitmap.

> procedure (draw-pict pict dc x y) → void?
> pict : pict?
> dc : (is-a?/c dc<%>)
> x : real?
> y : real?

Draws pict to dc, with its top-left corner at offset (x, y).

> procedure (pict->bitmap pict) → (is-a?/c bitmap%)
> pict : pict?

Returns a bitmap% with an alpha channel, no larger than pict, with pict drawn on it in the top-left corner (0, 0).

> procedure (make-pict-drawer pict)
> → ((is-a?/c dc<%>) real? real? . -> . void?)
> pict : pict?

Generates a pict-drawer procedure for multiple renderings of pict. Using the generated procedure can be faster than repeated calls to draw-pict.

> > procedure
> > (show-pict |  | pict |  |  |  |
> > | [ | w |  |  |  |
> > |  | h] |  |  |  |
> > |  | #:frame-x frame-x |  |  |  |
> > |  | #:frame-y frame-y |  |  |  |
> > |  | #:frame-style frame-style) |  | → |  | void?
> pict : pict?
> w : (or/c #f exact-nonnegative-integer?) = #f
> h : (or/c #f exact-nonnegative-integer?) = #f
> frame-x : (or/c (integer-in -10000 10000) #f)
> frame-y : (or/c (integer-in -10000 10000) #f)
> | frame-style |  | : |  |
> (listof (or/c 'no-resize-border 'no-caption
> 'no-system-menu 'hide-menu-bar
> 'toolbar-button 'float 'metal))

Opens a frame that displays pict. The frame adds one method, set-pict, which takes a pict to display. The optional w and h arguments specify a minimum size for the frame’s drawing area, and the frame-x, frame-y, and frame-style keyword arguments behave in the same manner as x, y, and style arguments for the frame%.

> parameter (current-expected-text-scale) → (list real? real?)
> (current-expected-text-scale scales) → void?
> scales : (list real? real?)

A parameter used to refine text measurements to better match an expected scaling of the image. The scale/improve-new-text form sets this parameter while also scaling the resulting pict.
top ← prev up next →