Is there a way to load a bitmap and then generate a palette from that bitmap with any win32 function?
Is there a way to load a bitmap and then generate a palette from that bitmap with any win32 function?
why would you want to do that?
or are you meaning mask.
I make embedded gambling games. We need to put all bitmaps in 1 large bitmap and then generate a palette from it. Right now we do this manually with gimp, but I wanted to make a windows tool to automate this. That's why. But I'm beginning to think this is not possible with standard win32 API functions. right?
Not if you're after what I think you're after, no. The best GDI can do is map whatever images you have to the default halftone palette (256 colours) or basic palette (16 colours). If you want to pick the colours in a different fashion you'll have to do it yourself.
Standard algorithms are median cut or octree.
You should theoretically create your bitmaps from a palette you have designed to contain all the colors you need. Then you save the bitmap and palette with it.
At load-time you load the bitmap and palette, switch the palette, and then load the bitmap. You are doing it backwards and there is no guarantee that your bitmaps can be broken into the exact number of colors you need and yet still maintain image integrity. Normally it's possible, but it's much easier to reverse this process and create your own palette.
This is how the old school VGA games worked. The artists created the palette which were then loaded into memory and the code would then tell the VGA hardware what the new palette was. Then the bitmap could be properly displayed as long as the palette did not change. Often times different levels and areas had different palettes. For instance, DOOM 1 was completely programmed in DOS using 256 color VGA graphics. And what they accomplished was nothing short of amazing in the small color space they were given.
Last edited by VirtualAce; 07-19-2006 at 02:26 AM.
yeah, the problem is that this hardware works with 3 layers
on the bottom layer things are drawn in 16-bit, so you can directly draw non palettized bitmaps on it.
The other 2 layers are palletized and you have to have 1 palette for it. An artist doesnt know on what layers things will come, and sometimes images are put on another layer for some reason. So we agreed that artists always deliver in 24 bit bmp's and when a programmer knows what images come on same layer he puts them all on one bitmap and generates an optimum palette. If images are moved to other layers that palette has to be recreated.
For another project only 1 palette was chosen, but then the quality of the artwork was way worse. We dont have doom's artists here
So a tool to generate palettes from bitmaps would be pretty handy. I gave up on trying it with win32 functions though
Very odd device. May I inquire as to what device it is?
its odd indeed
http://www.heber.co.uk/pluto6.htm
I found this, it uses GDI+
http://www.codeguru.com/Cpp/G-M/gdi/...icle.php/c3677