Next Previous Up Top Contents Index

5.3 DUIM-Sheets Module

with-drawing-options

Statement macro

Summary

Runs a body of code in the context of a set of drawing options.

Macro call

with-drawing-options ({medium} #rest {options}*) {body} end

Arguments

medium
A Dylan expressionbnf.

options
Dylan argumentsbnf.

body
A Dylan bodybnf.

Values

None.

Library

duim-sheets

Module

duim-sheets

Description

Runs a body of code in the context of a set of drawing options. The options specified are passed to the function do-with-drawing-options for execution.

The medium expression should evaluate to an instance of <medium>.

Note that when using with-drawing-options in conjunction with a loop. it is computationally much quicker to use a medium (as shown here) rather than a sheet, and to place the call to with-drawing-options outside the loop. If necessary, use with-sheet-medium to associate the sheet with the medium, thus:

with-sheet-medium (medium = sheet)
  with-drawing-options (medium, brush: color)
    for (x :: <integer> from 0 to 199)
      for (y :: <integer> from 0 to 199)
        draw-point(medium, x, y)
      end
    end
  end
end

Example

with-drawing-options (medium, brush: $red)
  draw-rectangle (medium, 0, 0, 100, 200, filled?: #t)
end;

See also

do-with-drawing-options, page 258

with-sheet-medium, page 384


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index