DynaPDF Manual - Page 236

Previous Page 235   Index   Next Page 237

Function Reference
Page 236 of 787
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
components on the stack are adjusted to the valid input range of the alternate color space and then
passed to it.
Note also that the remaining components on the stack must match the number of input colorants of
the alternate color space. It is an error to leave more or less components on the stack than supported
by the alternate color space.
Example 1:
In this example we create a DeviceN color space that contains the process colorants Cyan, Magenta,
and Yellow. The alternate color space is of course DeviceCMYK. The definition of the PostScript
calculator function is very simple in this example because we need to add the missing Black
component only. The array cls includes also the Black component here because we need the colorant
names later to add the definition of the process components to the DeviceN color space:
const char* cls[] = {"Cyan", "Magenta", "Yellow", "Black"};
const char ps[] = "{0}"; // Just add the missing Black component
 

Previous topic: DeviceN Attributes, Spot colorant attributes, Process colorant attributes, How to create the PostScript Calculator Function?

Next topic: Example 2:

Start Chat