jwwalker@usceast.UUCP (Jim Walker) (05/06/90)
I'm trying to use draft-mode bitmap printing (as described in IM V,
p. 415) to print a full-page bitmap at 144dpi on an ImageWriter. I
prepare the bitmap in an offscreen bitmap, and use CopyBits to copy
it to the printing GrafPort. However, this was failing for some
bitmaps; the printer would just print a digit at the left hand side
of the paper and stop.
I thought that the problem might relate to the warning in IM I that
"A good rule of thumb is not to copy more than 3K bytes." So I tried
copying the bitmap as a number of horizontal strips, as follows:
#define CHUNK_BITS 100000L
#define SLOP 4
SetPort( (GrafPtr) g_print_port_p );
dest_rect = (*g_print_port_p).gPort.portRect;
chunks = (int) ( ((long)dest_rect.right *
(long)dest_rect.bottom + CHUNK_BITS) / CHUNK_BITS );
chunk_depth = dest_rect.bottom / chunks;
dest_rect.top = 0;
dest_rect.bottom = chunk_depth;
for (which_chunk = 0; which_chunk < chunks; which_chunk++)
{
CopyBits( &g_offscreen_GrafPort.portBits,
&(*g_print_port_p).gPort.portBits,
&dest_rect,
&dest_rect,
srcCopy, nil );
dest_rect.top = dest_rect.bottom + SLOP;
dest_rect.bottom += chunk_depth;
}
That seems to have cured the problem I mentioned, but because of SLOP,
the printed image has some thin horizontal white lines through it.
But if I decrease SLOP at all, then the Imagewriter backs up at each
chunk boundary, causing noisy and inefficient printing.
--
Jim Walker jwwalker@usceast.cs.scarolina.edu 76367.2271@compuserve.com