18 pen-list%

▼ |  | The Racket Drawing Toolkit

1 | Overview
2 | bitmap%
3 | bitmap-dc%
4 | brush%
5 | brush-list%
6 | color%
7 | color-database<%>
8 | dc<%>
9 | dc-path%
10 | font%
11 | font-list%
12 | font-name-directory<%>
13 | gl-config%
14 | gl-context<%>
15 | linear-gradient%
16 | pdf-dc%
17 | pen%
18 | pen-list%
19 | point%
20 | post-script-dc%
21 | ps-setup%
22 | radial-gradient%
23 | record-dc%
24 | region%
25 | svg-dc%
26 | Drawing Functions
27 | Drawing Contracts
28 | Signature and Unit
29 | Unsafe Libraries
30 | Drawing Conveniences
31 | Platform Dependencies
| Bibliography
| Index

On this page:

new
find-or-create-pen

top ← prev up next →

class pen-list% : class?
superclass: object%

A pen-list% object maintains a list of pen% objects to avoid repeatedly creating pen objects. A pen% object in a pen list cannot be mutated.

A global pen list the-pen-list is created automatically.

> constructor (new pen-list%) → (is-a?/c pen-list%)

Creates an empty pen list.

> > method
> > (send a-pen-list find-or-create-pen |  | color |  |  |  |
> > |  | width |  |  |  |
> > |  | style |  |  |  |
> > | [ | cap |  |  |  |
> > |  | join]) |  | → |  | (is-a?/c pen%)
> color : (is-a?/c color%)
> width : (real-in 0 255)
> | style |  | : |  |
> (or/c 'transparent 'solid 'xor 'hilite
> 'dot 'long-dash 'short-dash 'dot-dash
> 'xor-dot 'xor-long-dash 'xor-short-dash
> 'xor-dot-dash)
> cap : (or/c 'round 'projecting 'butt) = 'round
> join : (or/c 'round 'bevel 'miter) = 'round
> (send a-pen-list find-or-create-pen |  | color-name |
> |  | width |
> |  | style |
> | [ | cap |
> |  | join]) |
> → (or/c (is-a?/c pen%) #f)
> color-name : string?
> width : (real-in 0 255)
> | style |  | : |  |
> (or/c 'transparent 'solid 'xor 'hilite
> 'dot 'long-dash 'short-dash 'dot-dash
> 'xor-dot 'xor-long-dash 'xor-short-dash
> 'xor-dot-dash)
> cap : (or/c 'round 'projecting 'butt) = 'round
> join : (or/c 'round 'bevel 'miter) = 'round

Finds a pen of the given specification, or creates one and adds it to the list. The arguments are the same as for creating a pen% instance plus a cap and join style as for set-cap and set-join. When color-name is provided, however, the return value is #f when no color matching color-name can be found in the-color-database.
top ← prev up next →