▼ |  | 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-brush

top ← prev up next →

> class

> brush-list% : class?

superclass: object%

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

A global brush list, the-brush-list, is created automatically.

> > constructor

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

Creates an empty brush list.

> > method

> > (send a-brush-list find-or-create-brush |  | color |
> > |  | style) |

> → (is-a?/c brush%)
> color : (or/c string? (is-a?/c color%))

> style

> :

> (or/c 'transparent 'solid 'opaque
> 'xor 'hilite 'panel
> 'bdiagonal-hatch 'crossdiag-hatch
> 'fdiagonal-hatch 'cross-hatch
> 'horizontal-hatch 'vertical-hatch)

> (send a-brush-list find-or-create-brush |  | color-name |
> |  | style) |

> → (or/c (is-a?/c brush%) #f)
> color-name : string?

> style

> :

> (or/c 'transparent 'solid 'opaque
> 'xor 'hilite 'panel
> 'bdiagonal-hatch 'crossdiag-hatch
> 'fdiagonal-hatch 'cross-hatch
> 'horizontal-hatch 'vertical-hatch)

Finds a brush of the given specification, or creates one and adds it to the list. See brush% for a further explanation of the arguments, which are the same as brush%’s initialization arguments.
top ← prev up next →