0

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.

skaffman
  • 398,947
  • 96
  • 818
  • 769
user549757
  • 32,962
  • 4
  • 19
  • 20

1 Answers1

2

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.
Chris Becke
  • 34,244
  • 12
  • 79
  • 148
  • yes I did that, but passing negative value of biHeight, Image header gets modified and so Image fails to load in my application. – user549757 Jan 12 '11 at 13:19
  • you need to explain how a modified image header might inhibit loading. Are you trying to save it to disk inverted? I don't think thats valid. If you are persisting a BMP to disk it MUST be bottom up. – Chris Becke Jan 12 '11 at 13:37