Page 127 Table of Contents Index Page 129
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



CHAPTER 14. GENERAL DESIGNS

Draws the pattern pattern on the sheet sheet at the position (x;y). pattern is any design created
by make-pattern. clipping-region and transformation are as for with-drawing-options or any
of the drawing functions.

Note that transformation only affects the position at which the pattern is drawn, not the pattern
itself. If a programmer wishes to affect the pattern, he should explicity call transform-region
on the pattern.

Drawing a bitmap consists of drawing an appropriately aligned and scaled pattern constructed
from the bitmap's bits. A 1 in the bitmap corresponds to +foreground-ink+, while a 0 corre-
sponds to +background-ink+ if an opaque drawing operation is desired, or to +nowhere+ if a
transparent drawing operation is desired.

Drawing a (colored) raster image consists of drawing an appropriately aligned and scaled pattern
constructed from the raster array and raster color map.

draw-pattern* could be implemented as follows, assuming that the functions pattern-width
and pattern-height return the width and height of the pattern.
 
 (defun draw-pattern* (sheet pattern x y &key clipping-region transformation)
   (check-type pattern pattern)
   (let ((width (pattern-width pattern))
         (height (pattern-height pattern)))
     (if (or clipping-region transformation)
       (with-drawing-options (sheet :clipping-region clipping-region
                                    :transformation transformation)
         (draw-rectangle* sheet x y (+ x width) (+ y height)
                          :filled t :ink pattern))
       (draw-rectangle* sheet x y (+ x width) (+ y height)
                        :filled t :ink pattern))))

14.6 Examples of More Complex Drawing Effects

Painting a gray or colored wash over a display. Specify a translucent design as the
ink, such as :ink (compose-in +black+ (make-opacity 0.25)), :ink (compose-in +red+
(make-opacity 0.1))
, or :ink (compose-in +foreground-ink+ (make-opacity 0.75)). The
last example can be abbreviated as :ink (make-opacity 0.75). On a non-color, non-grayscale
display this will usually turn into a stipple.

Drawing a faded but opaque version of the foreground color. Specify :ink (compose-
over (compose-in +foreground-ink+ (make-opacity 0.25)) +background-ink+)
to draw
at 25% of the normal contrast. On a non-color, non-grayscale display this will probably turn
into a stipple.


Page 127 Table of Contents Index Page 129
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E