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:
get-color
get-stipple
get-style
set-color
set-stipple
set-style

brush% : class?

  superclass: object%

A brush is a drawing tool with a color and a style that is used for filling in areas, such as the interior of a rectangle or ellipse. On a monochrome display, all non-white brushes are drawn as black.

In addition to its color and style, a brush can have a stipple bitmap. This stipple is used only in unsmoothed mode (see set-smoothing) or in a PostScript drawing context. Painting with a stipple brush is similar to calling draw-bitmap with the stipple bitmap in the filled region, except that the bitmap may not be scaled in the same way (depending on the platform and device).

A brush’s style is one of the following:

To draw outline shapes (such as unfilled boxes and ellipses), use the 'transparent brush style. See set-style for more information about styles.

To avoid creating multiple brushes with the same characteristics, use the global brush-list% object the-brush-list, or provide a color and style to set-brush in dc<%>.

(make-object brush%)  (is-a?/c brush%)
(make-object brush% color style)  (is-a?/c brush%)
  color : (is-a?/c color%)
  style : 
(one-of/c 'transparent 'solid 'opaque
          'xor 'hilite 'panel
          'bdiagonal-hatch 'crossdiag-hatch
          'fdiagonal-hatch 'cross-hatch
           'horizontal-hatch 'vertical-hatch)
(make-object brush% color-name style)  (is-a?/c brush%)
  color-name : string?
  style : 
(one-of/c 'transparent 'solid 'opaque
          'xor 'hilite 'panel
          'bdiagonal-hatch 'crossdiag-hatch
          'fdiagonal-hatch 'cross-hatch
           'horizontal-hatch 'vertical-hatch)
When no argument are provided, the result is a solid black brush. Otherwise, the result is a brush with the given color and style. For the case that the color is specified using a name, see color-database<%> for information about color names; if the name is not known, the brush’s color is black.

(send a-brush get-color)  (is-a?/c color%)
Returns the brush’s color.

(send a-brush get-stipple)  (or/c (is-a?/c bitmap%) false/c)
Gets the stipple bitmap, or #f if the brush has no stipple.

(send a-brush get-style)
  
(one-of/c 'transparent 'solid 'opaque
          'xor 'hilite 'panel
          'bdiagonal-hatch 'crossdiag-hatch
          'fdiagonal-hatch 'cross-hatch
          'horizontal-hatch 'vertical-hatch)
Returns the brush’s style. See brush% for information about brush styles.

(send a-brush set-color color)  void?
  color : (is-a?/c color%)
(send a-brush set-color color-name)  void?
  color-name : string?
(send a-brush set-color red green blue)  void?
  red : (integer-in 0 255)
  green : (integer-in 0 255)
  blue : (integer-in 0 255)
Sets the brush’s color. A brush cannot be modified if it was obtained from a brush-list% or while it is selected into a drawing context.

For the case that the color is specified using a string, see color-database<%> for information about color names.

(send a-brush set-stipple bitmap)  void?
  bitmap : (or/c (is-a?/c bitmap%) false/c)
Sets or removes the stipple bitmap, where #f removes the stipple. See brush% for information about drawing with stipples.

A bitmap cannot be used as a stipple if it is selected into a bitmap-dc% object; if the given bitmap is selected into a bitmap-dc% object, an exn:fail:contract exception is raised. A brush cannot be modified if it was obtained from a brush-list% or while it is selected into a drawing context.

A pen’s stipple is not used in a smoothing mode, except for a post-script-dc% (which is always in a smoothing mode).

(send a-brush set-style style)  void?
  style : 
(one-of/c 'transparent 'solid 'opaque
          'xor 'hilite 'panel
          'bdiagonal-hatch 'crossdiag-hatch
          'fdiagonal-hatch 'cross-hatch
          'horizontal-hatch 'vertical-hatch)
Sets the brush’s style. See brush% for information about the possible styles.

A brush cannot be modified if it was obtained from a brush-list% or while it is selected into a drawing context.