Although objects drawn with interpolated shading look good on the screen, objects consisting of large numbers of interpolated patches generally take an unacceptably long time to print. This is not because the PostScript files are excessively large, but rather because most printers are overwhelmed by the computations required to determine the exact shading/coloring of each point.
Unlike flat and faceted shading, in which the color of each patch is constant and specified directly in the PostScript code, the PostScript files generated for interpolated shading contain the color information of the patches' vertices. The interpolation calculations are done by the printer. This may result in extremely long print times for graphics using interpolated shading. In many cases, printers "time-out" (i.e., abort the print job) due to the long wait.
There are several possible workarounds for obtaining interpolated shaded figures:
1. Approximate Interpolated Shading
Interpolated shading can be approximated by interpolating the actual data used to construct the object, and then plotting the interpolated data using flat shading. The result is an increased number of constant-colored patches. As the number of patches increases, and the size of each patch decreases, the approximation to interpolated shading improves. A MATLAB function that performs data interpolation and re-plots the figure is included at the end of this solution.
2. LPR method
Note that this method may result in large PostScript files.
In some UNIX environments, the default lpr command will not print files larger than 1 Mbyte. Files larger than 1 Mbyte can be printed via the lpr -s command (see the man pages for lpr).
3. Edit the PostScript File
The default resolution value for interpolated shading is 16 (i.e., 16 different shades per patch). This value can be changed to either 8 or 4 by editing the PostScript file. The result is a decrease in the quality of the image and an increase in printing speed. To change the resolution value, edit the PostScript file and search for the string NI. The search should find the following line of code:
/NI 16 def
8 (medium), or 16 (high-res)
Change the number to the desired resolution, save the file, and print. Below is a sample MATLAB function to perform data interpolation.
function hfi = app_int(x,y,z,s,dc)
if ( nargin == 3 )
dc = z;
z = x;
s = y;
[m n] = size(z);
x = 1:n; y = (1:m)';
mscal = m*s;
nscal = n*s;
xi = linspace(1,n,nscal);
yi = linspace(1,m,mscal)';
zi = interp2(x,y,z,xi,yi);
figure;
cmd = ['hfi=' dc '(xi,yi,zi);'];
eval(cmd);
shading flat;
elseif ( nargin == 5 )
[m n] = size(z);
mscal = m*s;
nscal = n*s;
mint = min(min(x));
maxt = max(max(x));
xi = linspace(mint,maxt,mscal);
mint = min(min(y));
maxt = max(max(y));
yi = linspace(mint,maxt,nscal)';
zi = interp2(x,y,z,xi,yi);
figure;
cmd = ['hfi=' dc '(xi,yi,zi);'];
eval(cmd);
shading flat;
end
4. Use a Screen Bitmap
Also note that on workstations, the capture command can be used to produce a bitmap screen image of the current figure window. Since this is only a bitmap copy, the resolution will be of much lesser quality than resolution obtained by applying the print command to the original figure.
On PC's, the ALT + Print Screen combination can be used to send a bitmap screen image to the clipboard. This image will include the window border. Import the image into a graphics package such as MS Paintbrush (included with MS Windows), in order to remove the window borders and print.