Previous Next


                                          177
SECTION 3.9                                                               Functions



A type 4 function dictionary includes the entries in Table 3.35 on page 168, as
well as other appropriate stream attributes (see Table 3.4 on page 62). Example
3.20 shows a type 4 function equivalent to the predefined spot function
DoubleDot (see Section 6.4.2, “Spot Functions”).

Example 3.20

  10 0 obj
      << /FunctionType 4
          /Domain [ −1.0 1.0 −1.0 1.0 ]
          /Range [ −1.0 1.0 ]
          /Length 71
      >>
  stream
      { 360 mul sin
        2 div
        exch 360 mul sin
        2 div
        add
      }
  endstream
  endobj

The Domain and Range entries are both required. The input variables constitute
the initial operand stack; the items remaining on the operand stack after
execution of the function are the output variables. It is an error for the number of
remaining operands to differ from the number of output variables specified by
Range or for any of them to be objects other than numbers.

Implementations of type 4 functions must provide a stack with room for at least
100 entries. No implementation is required to provide a larger stack, and it is an
error to overflow the stack.

Although any integers or real numbers that may appear in the stream fall under
the same implementation limits (defined in Appendix C) as in other contexts, the
intermediate results in type 4 function computations do not. An implementation
may use a representation that exceeds those limits. Operations on real numbers,
for example, might use single-precision or double-precision floating-point
numbers. (See implementation note 44 in Appendix H.)

Previous Next