{"size": 2041, "ext": "scrbl", "max_stars_repo_path": "draw-doc/scribblings/draw/pen-list-class.scrbl", "max_stars_repo_name": "Bogdanp/draw", "max_stars_repo_stars_event_min_datetime": "2015-03-24T15:04:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-25T03:43:21.000Z", "max_issues_repo_path": "draw-doc/scribblings/draw/pen-list-class.scrbl", "max_issues_repo_name": "Bogdanp/draw", "max_issues_repo_issues_event_min_datetime": "2015-01-30T20:28:55.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T08:43:11.000Z", "max_forks_repo_path": "draw-doc/scribblings/draw/pen-list-class.scrbl", "max_forks_repo_name": "Bogdanp/draw", "max_forks_repo_forks_event_min_datetime": "2015-01-29T22:12:33.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-17T09:51:49.000Z"}
{"max_stars_count": 15, "max_issues_count": 37, "max_forks_count": 21, "avg_line_length": 42.5208333333, "max_line_length": 87, "alphanum_fraction": 0.4938755512}
#lang scribble/doc
@(require "common.rkt")

@defclass/title[pen-list% object% ()]{

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

A global pen list @indexed-racket[the-pen-list] is created automatically.


@defconstructor[()]{

Creates an empty pen list.


}

@defmethod*[([(find-or-create-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])
              (is-a?/c pen%)]
             [(find-or-create-pen [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])
              (or/c (is-a?/c pen%) #f)])]{

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 @racket[pen%]
instance plus a cap and join style as for @method[pen% set-cap] and
@method[pen% set-join]. When @racket[color-name] is provided, however, the return
value is @racket[#f] when no color matching @racket[color-name] can be
found in @racket[the-color-database].

}}

