Next Previous Up Top Contents Index

5.3 DUIM-Sheets Module

with-sheet-medium

Statement macro

Summary

Associates a sheet with a medium.

Macro call

with-sheet-medium ({medium = sheet}) {body} end

Arguments

medium
A Dylan namebnf.

sheet
A Dylan expressionbnf.

body
A Dylan bodybnf.

Values

None.

Library

duim-sheets

Module

duim-sheets

Description

Associates a sheet with a medium.

Within body, the variable medium is bound to the medium allocated to sheet. The sheet specified should be an instance of type <sheet>. If sheet does not have a medium permanently allocated, one is allocated and associated with sheet for the duration of body, and then unassociated from sheet and deallocated when body has been exited. The values of the last form of body are returned as the values of with-sheet-medium.

The medium argument is not evaluated, and must be a symbol that is bound to a medium. The body may have zero or more declarations as its first forms.

This macro is a useful way of speeding up drawing operations, since drawing on a sheet requires finding the medium for that sheet. You can use with-sheet-medium to associate a known sheet with a medium, and then draw directly onto that medium, as shown in the example.

Example

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

See also

do-with-sheet-medium, page 260

with-drawing-options, page 378


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index