14.5 Arbitrary Designs

draw-design  medium design &key ink clipping-region transformation line-style line-thickness line-unit line-dashes line-joint-shape line-cap-shape text-style text-family text-face text-size [Generic Function]
          

Draws the design design onto the medium medium. This is defined to work for all types of regions and designs, although in practice some implementations may be more restrictive. ink, transformation, and clipping-region are used to modify the medium. The other drawing arguments control the drawing of the design, depending on what sort of design is being drawn. For instance, if design is a path, then line style options may be supplied. [annotate]

If design is an area, draw-design paints the specified region of the drawing plane with medium's current ink. If design is a path, draw-design strokes the path with medium's current ink under control of the line-style. If design is a point, draw-design is the same as draw-point. [annotate]

Note:

Is the current transformation of the medium applied to areas or paths?

If not so: How should the line style be applied?

If so: Why is that different from other non-uniform design, which are not subject the current transformation of the medium. [See below.]

I would prefer, that both cases are handled the same. For instance one might want to create a circular icon by:

(compose-in (make-pattern ...) (make-circle* 50 50 50))

It would be strange, if the circle is transformed by the current transformation, but the pattern is not.

[edit]-- Gilbert Baumann 2016-08-29 15:18Z
 

If design is a color or an opacity, draw-design paints the entire drawing plane (subject to the clipping region of the medium). [annotate]

If design is +nowhere+, draw-design has no effect. [annotate]

If design is a non-uniform design (see Chapter 14), draw-design paints the design, positioned at coordinates (0,0). [annotate]

CLIM implementations are required to support draw-design for the following cases: [annotate]

[annotate]

Note: Since the section "Design Protocol" lacks any [annotate] links: Yes, draw-design is everything you'd need for a general design protocol in the days of powerful GPUs. [edit]-- Gilbert Baumannn 2005-03-06 23:46Z
 

draw-pattern*  medium pattern x y &key clipping-region transformation [Function]
          

Draws the pattern pattern on the medium medium 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. [annotate]

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. [annotate]

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 corresponds to +background-ink+ if an opaque drawing operation is desired, or to +nowhere+ if a transparent drawing operation is desired. [annotate]

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

draw-pattern* could be implemented as follows, assuming that the functions pattern-width and pattern-height return the width and height of the pattern. [annotate]

(defun draw-pattern* (medium 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 (medium :clipping-region clipping-region
                                      :transformation transformation)
          (draw-rectangle* medium x y (+ x width) (+ y height)
                           :filled t :ink pattern))
        (draw-rectangle* medium x y (+ x width) (+ y height)
                         :filled t :ink pattern))))

[annotate]

Note: The above definition of draw-pattern* is perhaps oversimplified in case the medium already has a transformation set. Further: When the given transformation is not a translation the rectangle drawn does not cover the exact extend of the pattern. Third and most important: It misses transforming the pattern at all. At least this is what I believe it should do. [edit]-- Gilbert Baumann 2003-06-02 05:43Z