home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / windows / ms / programm / 7311 < prev    next >
Encoding:
Text File  |  1992-07-22  |  2.2 KB  |  48 lines

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