Question

I have generated bitmap.dll through winddk.

Added manually as a printer driver selecting print-to-file driver.

Using this I create an image of my document using print command from file.

I am able to create image and view it, But the problem is that I get inverted(mirror) image.

cScans = pOemPDEV->bmInfoHeader.biHeight;
// Flip the biHeight member so that it denotes top-down bitmap 
pOemPDEV->bmInfoHeader.biHeight = cScans * -1;

Have anyone workaround of this code? As I get the problem when I comment(to get header properly generated) this lines.

Was it helpful?

Solution

Device Independent Bitmaps are documented as being laid out in memory with the bottom line at the start of the buffer. Its an experiment in cartesian co-ordinates perpetrated by the designers of OS/2 who were working with Microsoft at the same time Windows 3 was being developed.

There are two possible fixes:

  1. Generate your buffer upside down.
  2. Many Windows APIs that take a BITMAPINFO treat a negative biHeight value to mean a top down DIB.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top