% Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
% $Id: gs_l2img.ps 8954 2008-08-08 04:22:38Z ray $
% Emulate the Level 2 dictionary-based image operator in Level 1,
% except for Interpolate (ignored) and MultipleDataSources = true;
% also, we require that the data source be either a procedure of a
% particular form or a stream, not a string or a general procedure.
% pdf2ps copies the portion of this file from %BEGIN to %END if Level 1
% compatible output is requested.
/currentglobal where
{ pop currentglobal { setglobal } true setglobal }
{ { } }
ifelse
/packedarray where
{ pop }
{ /packedarray { array astore readonly } bind def }
ifelse
%BEGIN
11 dict /.csncompdict 1 index def begin
/DeviceGray { 1 /setgray load } bind def
/DeviceRGB { 3 /setrgbcolor load } bind def
/DeviceCMYK { 4 /setcmykcolor load } bind def
/Indexed
{ dup 1 index 1 get //.csncompdict exch get exec
% Stack: [/Indexed base hival map] ncomp basesetcolor
3 -1 roll 3 get mark 3 1 roll
% Stack: ncomp -mark- basesetcolor map
dup type /stringtype eq
{ { -
{ exch round cvi get 255 div
}
-
{ exch round cvi 3 mul 2 copy 2 copy get 255 div
3 1 roll 1 add get 255 div
4 2 roll 2 add get 255 div
}
{ exch round cvi 4 mul 2 copy 2 copy 2 copy get 255 div
3 1 roll 1 add get 255 div
4 2 roll 2 add get 255 div
5 3 roll 3 add get 255 div
}
}
4 index get aload pop counttomark -1 roll
}
{ /exec load 3 -1 roll
% Stack: -mark- mapproc --exec-- basesetcolor
}
ifelse .packtomark cvx
exch pop 1 exch
} bind def
/Separation
{ dup 2 index //.csncompdict exch get exec
% Stack: [/Separation name alt xform] ncomp altsetcolor
3 -1 roll 3 get /exec load 3 -1 roll 3 array astore readonly cvx
exch pop 1 exch
} bind def
% Substitute device spaces for CIE spaces.
/CIEBasedA /DeviceGray load def
/CIEBasedABC /DeviceRGB load def
/CIEBasedDEF /DeviceRGB load def
/CIEBasedDEFG /DeviceCMYK load def
end
/.packtomark { counttomark packedarray exch pop } bind def
/.csinextbits % - .csinextbits