home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.ms.programmer
- Path: sparky!uunet!gatech!psuvax1!uxa.ecn.bgu.edu!news.ils.nwu.edu!feist
- From: feist@ils.nwu.edu (Steven Feist)
- Subject: Re: Diplaying BMP files under Windows 3.x
- Message-ID: <1992Jul22.152456.3259@ils.nwu.edu>
- Sender: usenet@ils.nwu.edu (Mr. usenet)
- Nntp-Posting-Host: aristotle.ils.nwu.edu
- Organization: The Institute for the Learning Sciences
- References: <1682BEB88.SSCHEMA@ibm.gwdg.de> <1992Jul21.180439.12547@twisto.eng.hou.compaq.com>
- Date: Wed, 22 Jul 1992 15:24:56 GMT
- Lines: 35
-
- In article <1992Jul21.180439.12547@twisto.eng.hou.compaq.com> mccreary@sword.eng.hou.compaq.com (Ed McCreary) writes:
- >In article <1682BEB88.SSCHEMA@ibm.gwdg.de> SSCHEMA@ibm.gwdg.de (Stefan Schemat) writes:
- >>Does anybody knows how to load and display a BMP file with 256
- >>colors under Windows 3.x?
- ...
- >... you need to create a logical palette based upon the colors needed in the
- >image, select it into the device context and realize it before displaying.
-
- It just so happens that we just wasted a fair amount of time figuring
- out how exactly this works. After giving up on the Microsoft Windows
- manuals, we figured it out based on information in the Windows API
- Bible from the Waite Group Press. Thank you very much, Microsoft, for
- your fine, thorough, clear, and complete documentation. It turns out
- that LoadBitmap always maps the colors in your bitmap to the 20 system
- colors, even if the image is 256 colors and your device has 256 colors
- available, so you can't use LoadBitmap to do what you want (I'm pretty
- sure this is true; if anyone thinks they know otherwise, please let me
- know.)
-
- As far as I know, the only reasonable (by Microsoft Windows standards)
- way to accomplish what you want is to use FindResource, LoadResource,
- and LockResource to get your hands on the color table and bits for
- your bitmap resource; then to build and realize an appropriate
- palette for the color table using CreatePalette, SelectPalette, and
- RealizePalette; and finally to use SetDIBitsToDevice to do the
- display. (You also could do something similar to build the proper
- 256 color device dependent bitmap for later BitBlt-ing.)
-
-
-
- --
- Steven Feist (feist@ils.nwu.edu)
- Institute for the Learning Sciences
- 1890 Maple Avenue
- Evanston, IL 60201
-