[comp.lang.postscript] Replacing the transfer function to get a negative

shiva@well.sf.ca.us (Kenneth Porter) (04/30/91)

Remember that when changing the transfer function, you should
carry along the old definition.  It may contain code to
compensate for a non-linear marking engine, or it may have been
previously modified by an enclosing application to achieve a
special effect.
 
================================================================
% We must call existing transfer function after ours
% for proper mapping of user grays to device grays.
/oldtransfer currenttransfer def
 
% Function just subtracts requested gray from 1, then
% calls device transfer function.
{ 1 exch sub oldtransfer } bind settransfer
 
% init page to logical "white"
gsave
  1 setgray clippath fill
grestore
================================================================
 
Ken (shiva@well.sf.ca.us)