🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.windows.ms.programmer
3 messages
3 total messages Started by Stefan Schemat Tue, 21 Jul 1992 16:44
Diplaying BMP files under Windows 3.x
#16
Author: Stefan Schemat
Date: Tue, 21 Jul 1992 16:44
9 lines
892 bytes
Does anybody knows how to load and display a BMP file with 256
colors under Windows 3.x?
First we have tried to display that bitmap with the GDI-command
"BitBlt()" after including it in the program's ressources. It
appeared very fast, but only with a few colors.
Then we loaded and displayed it pixel by pixel with "SetPixel()".
This method shows all colors, but it is veeeeeery sloooooow.
Ciao Stefan
sschema@ibm.gwdg.de
Re: Diplaying BMP files under Windows 3.x
#18
Author: Ed McCreary
Date: Tue, 21 Jul 1992 18:04
23 lines
1707 bytes
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?
>First we have tried to display that bitmap with the GDI-command
>"BitBlt()" after including it in the program's ressources. It
>appeared very fast, but only with a few colors.
>Then we loaded and displayed it pixel by pixel with "SetPixel()".
>This method shows all colors, but it is veeeeeery sloooooow.
>Ciao Stefan
>sschema@ibm.gwdg.de

I assume you have a video card capable of suporting 256 colors.  If so,
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.
If your using the SDK, there's a section on logical palettes in one
of the volumes.  It's the programmer's guide I believe.  

Remember to realized the palette just before creating the bitmap also.

--
McCreary@sword.eng.hou.compaq.com     Computers are like Old Testament gods;
Me? Speak for Compaq?  Yeah, right.   lots of rules and no mercy.
"By this time my lungs were aching for air..."               Joseph Campbell
Re: Diplaying BMP files under Windows 3.x
#31
Author: Steven Feist
Date: Wed, 22 Jul 1992 15:24
35 lines
2313 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads