► |  | GUI: Racket Graphics Toolkit

1 | Overview
2 | Reference
3 | Configuration
4 | Dynamic Loading
| Bibliography
| Index

► | 2 | Reference

2.1 | Windowing Classes
2.2 | Windowing Functions
2.3 | Drawing Classes
2.4 | Drawing Functions
2.5 | Editor Classes
2.6 | Editor Functions
2.7 | WXME Decoding

▼ | 2.3 | Drawing Classes

2.3.1 | bitmap%
2.3.2 | bitmap-dc%
2.3.3 | brush%
2.3.4 | brush-list%
2.3.5 | color%
2.3.6 | color-database<%>
2.3.7 | dc<%>
2.3.8 | dc-path%
2.3.9 | font%
2.3.10 | font-list%
2.3.11 | font-name-directory<%>
2.3.12 | gl-config%
2.3.13 | gl-context<%>
2.3.14 | pen%
2.3.15 | pen-list%
2.3.16 | point%
2.3.17 | post-script-dc%
2.3.18 | printer-dc%
2.3.19 | ps-setup%
2.3.20 | region%

On this page:

find-or-create-pen

top ← prev up next →

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.

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

Creates an empty pen list.

( 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

:

( 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)

cap : ( one-of/c 'round 'projecting 'butt) = 'round
join : ( one-of/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% ) false/c )
color-name : string?
width : ( real-in 0 255)

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)

cap : ( one-of/c 'round 'projecting 'butt) = 'round
join : ( one-of/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 →