[comp.windows.ms.programmer] some questions about printing bitmaps

cm@jet.uucp (colin manning) (03/27/91)

I' experiencing problems printing a monochrome bitmap in
Windows 3. If anyone can suggest what I'm doing wrong, I'd
like to hear from them.

I have a smallish, fixed size monochrome bitmap which I 
simply want to print reliably on any printer capable of
BITBLT'ing. I want the image to retain its aspect ratio, but
be expanded so as to make use of available printer real estate.

At present I select the bitmap into a memory DC compatible with
the printer, and then bitblt from it to the printer DC using
banding. This works fine. However, on something like a Laserjet IIp
you get a printout the size of a postage stamp. In this case I'm 
using MM_TEXT mapping mode throughout.

So then I say, in order to blow the image up to size, change the
mapping mode in the printer DC to MM_ISOTROPIC, and set the viewport
width to the printer device width in pixels (obtained from GetDeviceCaps)
and the window width to the pixel width of my image, and similarly
in the vertical axis. When I do the NEXTBAND escape the rectangle coords
I get are in physical device coords, so I convert them to my logical
bitmap coords using DPtoLP, and then bitblt from the printer memory DC
(still in MM_TEXT) to the printer DC.

And whats the result of all this hard work ? - nothing. The image
is still the same, tiny, size. Further investigation reveals that
my attempts to change the mapping mode in the printer DC have no
effect, since as soon as I have got a non-empty rectangle back from
the NEXTBAND escape, the printer DC's mapping mode has reverted to
MM_TEXT and I'm back where I started.

If anyone can tell me why this doesnt work, or perhaps more usefully,
what I should actually be doing to perform this (presumeably simple)
task, I'd appreciate some help.

Another solution I considered was doing a StretchBlt from my small
bitmap into a bitmap with the same width and height as the printer's 
device width + height, and then just bitblt'ing this to the
printer DC, and not try to do the transformation with mapping modes
at all. I have tried this, and it appears to work OK on the Laserjet
but crashes with other printer drivers. I guess that this might be
to do with support for bitmaps >64k which not all printer drivers,
including the Epson one, handle (according to GetDeviceCaps).

Separate question: If you have a large (>64k) bitmap you want to
print on a printer whose Windows device driver does not support 
bitmaps >64k, how do you do it ?

Many thanks in advance,
-- 
- Colin Manning, cm%jet.uucp@ukc.ac.uk (world) OR cm@jet.uucp (UK only)

------------------------------
Disclaimer: Please note that the above is a personal view and should not 
be construed as an official comment from the JET project.