May 15th, 2013

What does GDI use biXPelsPerMeter and SetBitmapDimensionEx for?

What does GDI use BITMAP­INFO­HEADER.biXPels­Per­Meter and Set­Bitmap­Dimension­Ex for?

Nothing.

The BITMAP­INFO­HEADER.biXPels­Per­Meter and BITMAP­INFO­HEADER.biYPels­Per­Meter are completely ignored by GDI when loading a bitmap. The values are there for the benefit of image-editing programs who want to record additional information about the bitmap, but GDI ignores them.

Similarly, the Set­Bitmap­Dimension­Ex and Get­Bitmap­Dimension­Ex functions update a SIZE structure associated with each bitmap, but GDI does nothing with the values, aside from initializing them to zero when the bitmap is created.

The value is there so that, for example, a program which puts a bitmap on the clipboard can specify the recommended physical dimensions of the bitmap, in order to help another program that reads the bitmap from the clipboard (for example, a word processor) decide how big to resize the bitmap when it is pasted.

Whether any programs actually do this sort of thing I do not know.

But that’s what it’s there for, in case anybody wanted to do it.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.