DynaPDF Manual - Page 249

Previous Page 248 Index Next Page 250

Function Reference

Page 249 of 818

The array of colorant names must correspond, in order, to the components of the process color

space. For example, an RGB color space must have three names corresponding to red, green, and

blue. The names may be arbitrary (that is, not the same as the standard names for the color space

components) but must match those specified in the DeviceN color space, even if not all components

are present in the DeviceN color space.

The defintion of process colorants of a DeviceCMYK color space is optional since the colorant names

Cyan, Magenta, Yellow, and Black are always considered as color components of a DeviceCMYK

color space.

How to create the PostScript Calculator Function?

A PostScript calculator function is represented as a string containing code written in a small subset

of the PostScript language. The language that can be used in a PostScript calculator function

contains expressions involving integers, real numbers, and boolean values only. There are no

composite data structures such as strings or arrays, no procedures, and no variables or names.

The following operators are supported in a PostScript calculator function:

Operator type

Operators

Arithmetic operators

abs

cvi

floor

mod

sin

add

cvr

idiv

mul

sqrt

atan

div

ln

neg

sub

ceiling

exp

log

round

truncate

cos

Relational, boolean,

and

false

le

not

true

and bitwise operators

bitshift

ge

lt

or

xor

eq

gt

ne

Conditional operators

if

ifelse

Stack operators

copy

exch

pop

dup

index

roll

For more information on these operators, see Appendix B of the PostScript Language Reference,

Third Edition. The operand syntax for PostScript calculator functions follows PDF conventions

rather than PostScript conventions. The entire code defining the function is enclosed in braces { }.

Braces also delimit expressions that are executed conditionally by the if and ifelse operators:

boolean { expression } if

boolean { expression1 } { expression2 } ifelse

This construct is purely syntactic; unlike in PostScript, no "procedure objects" are involved.

When executing the function, the application pushes first the tint values of the setcolor operator or

the corresponding image components on the stack. The function is then executed and the remaining

Previous topic: Encoding of Colorant Names, DeviceN Attributes, Spot colorant attributes, Process colorant attributes

Next topic: Example 1:, Example 2: