▼ |  | Pict: Functional Pictures

1 | Pict Datatype
2 | Basic Pict Constructors
3 | Pict Combiners
4 | Pict Drawing Adjusters
5 | Bounding Box Adjusters
6 | Pict Finders
7 | More Pict Constructors
8 | Animation Helpers
9 | Tree Layout
10 | Miscellaneous
11 | Rendering
12 | Conversion to Picts

On this page:

scale
scale-to-fit
rotate
ghost
linewidth
linestyle
colorize
cellophane
clip
inset/ clip
scale/ improve-new-text
black-and-white

top ← prev up next →

### 4`` Pict Drawing Adjusters

> procedure (scale pict factor) → pict?
> pict : pict?
> factor : real?
> (scale pict w-factor h-factor) → pict?
> pict : pict?
> w-factor : real?
> h-factor : real?

Scales a pict drawing, as well as its bounding box, by multiplying it current size by factor (if two arguments are supplied) or by multiplying the current width by w-factor and current height by h-factor (if three arguments are supplied).

The drawing is scaled by adjusting the destination dc<%>’s scale while drawing the original pict.

Examples:
> > (filled-rectangle 80 40)
> > (scale (filled-rectangle 40 20) 2)
> > (scale (filled-rectangle 20 20) 4 2)

> procedure (scale-to-fit pict size-pict) → pict?
> pict : pict?
> size-pict : pict?
> (scale-to-fit pict width height) → pict?
> pict : pict?
> width : real?
> height : real?

Scales pict so that it fits within the bounding box of size-pict (if two arguments are supplied) or into a box of size width by height (if three arguments are supplied).

The aspect ratio of the pict is preserved, so the resulting pict will have either the width or the height of the size-pict (or width by height box), but not necessarily both.

> procedure (rotate pict theta) → pict?
> pict : pict?
> theta : real?

Rotates a pict’s drawing by theta radians counter-clockwise.

The bounding box of the resulting pict is the box encloses the rotated corners of pict (which inflates the area of the bounding box, unless theta is a multiple of half of pi). The ascent and descent lines of the result’s bounding box are the horizontal lines that bisect the rotated original lines; if the ascent line drops below the descent line, the two lines are flipped.

> procedure (ghost pict) → pict?
> pict : pict?

Creates a container picture that doesn’t draw the child picture, but uses the child’s size.

> procedure (linewidth w pict) → pict?
> w : (or/c real? #f)
> pict : pict?

Selects a specific pen width for drawing, which applies to pen drawing for pict that does not already use a specific pen width. A #f value for w makes the pen transparent (in contrast to a zero value, which means “as thin as possible for the target device”).

> procedure (linestyle style pict) → pict?
> | 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)
> pict : pict?

Selects a specific pen style for drawing, which applies to pen drawing for pict that does not already use a specific pen style.

> procedure (colorize pict color) → pict?
> pict : pict?
> | color |  | : |  |
> (or/c string? (is-a?/c color%)
> (list/c byte? byte? byte?))

Selects a specific color drawing, which applies to drawing in pict that does not already use a specific color. The black-and-white parameter causes all non-white colors to be converted to black.

> procedure (cellophane pict opacity) → pict?
> pict : pict?
> opacity : (real-in 0 1)

Makes the given pict semi-transparent, where an opacity of 0 is fully transparent, and an opacity of 1 is fully opaque. See set-alpha for information about the contexts and cases when semi-transparent drawing works.

> procedure (clip pict) → pict
> pict : pict?

Clips a pict’s drawing to its bounding box.

> procedure (inset/clip pict amt) → pict?
> pict : pict?
> amt : real?
> (inset/clip pict h-amt v-amt) → pict?
> pict : pict?
> h-amt : real?
> v-amt : real?
> (inset/clip pict l-amt t-amt r-amt b-amt) → pict?
> pict : pict?
> l-amt : real?
> t-amt : real?
> r-amt : real?
> b-amt : real?

Insets and clips the pict’s drawing to its bounding box. Usually, the inset amounts are negative.

> syntax (scale/improve-new-text pict-expr scale-expr)
> (scale/improve-new-text pict-expr x-scale-expr y-scale-expr)

Like the scale procedure, but also sets current-expected-text-scale while evaluating pict-expr.

> parameter (black-and-white) → boolean?
> (black-and-white on?) → void?
> on? : any/c

A parameter that determines whether colorize uses color or black-and-white colors.
top ← prev up next →