In addition to its color, width, and style, a pen can have a pen stipple bitmap. Drawing with a stipple pen is similar to calling draw-bitmap with the stipple bitmap in region painted by the pen.
A pen style is one of the following:
'transparent —
Draws with no effect (on the outline of the drawn shape). 'solid —
Draws using the pen’s color. If a (monochrome) pen stipple is installed into the pen, black pixels from the stipple are transferred to the destination using the brush’s color, and white pixels from the stipple are not transferred. 'xor —
The same as 'solid, accepted only for partial backward compatibility. - The following special pen modes use the pen’s color, and they only apply when a pen stipple is not used:
To avoid creating multiple pens with the same characteristics, use the global pen-list% object the-pen-list, or provide a color, width, and style to set-pen in dc<%>.
When drawing in 'smoothed or 'aligned mode, a pen’s size is truncated after scaling to an integral size. A pen of size 0 (after truncation, if applicable) uses a non-zero, scale-insensitive line size for the destination drawing context: 1/4 unit (after scaling) for post-script-dc% or pdf-dc% contexts in 'smoothed mode, or 1 unit (after scaling) for any other context. For example, in unscaled canvas and bitmap contexts, a zero-width pen behaves the same as a pen of size 1.
See also make-pen.
constructor
(new pen% [ [color color] [width width] [style style] [cap cap] [join join] [stipple stipple]]) → (is-a?/c pen%) color : (or/c string? (is-a?/c color%)) = "black" width : (real-in 0 255) = 0
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) = 'solid cap : (or/c 'round 'projecting 'butt) = 'round join : (or/c 'round 'bevel 'miter) = 'round stipple : (or/c #f (is-a?/c bitmap%)) = #f
This code draws three diagonal lines, one with each of the possible caps ('round, 'butt, and then 'projecting) and puts a little red dot on the end points of the line.
Examples: | ||||||||||||||||||||||||||
|
This code shows the three join styles ('round, 'bevel and then 'miter) by drawing a sequence of lines, first with a sharp corner and then with a right-angle. Each of the end points of the lines i with a red dot.
Examples: | |||||||||||||||||||||||||||||||||||
|
method
(send a-pen get-stipple) → (or/c (is-a?/c bitmap%) #f)
method
→
(or/c 'transparent 'solid 'xor 'hilite 'dot 'long-dash 'short-dash 'dot-dash 'xor-dot 'xor-long-dash 'xor-short-dash 'xor-dot-dash)
method
(send a-pen is-immutable?) → boolean?
A pen cannot be modified if it was obtained from a pen-list% or while it is selected into a drawing context.
method
color : (is-a?/c color%) (send a-pen set-color color-name) → void? color-name : string? (send a-pen set-color red green blue) → void? red : byte? green : byte? blue : byte?
A pen cannot be modified if it was obtained from a pen-list% or while it is selected into a drawing context.
A pen cannot be modified if it was obtained from a pen-list% or while it is selected into a drawing context.
If bitmap is modified while is associated with a pen, the effect on the pen is unspecified. A pen cannot be modified if it was obtained from a pen-list% or while it is selected into a drawing context.
method
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)
A pen cannot be modified if it was obtained from a pen-list% or while it is selected into a drawing context.