16 bit images in directx
8/24/32 bit images to 16 bit surface in DX.
Check the DDUTIL.CPP in your DirectX SDK.
The DDLoadBMP function can do this.
You will have a very hard time finding a program that saves images in 16 bit mode. The sollution most of us take, I suspect, is saving images in 24 bit colour and dropping the least significant bits when loading. I hate the way this looks on some images because it introduces banding in gradiants. I just make a special effort to do my art very very carefully.
When you are setting up your DDSURFACEDESC structure, and you are putting in the ddsCaps flags, you can plug in the DDSCAPS_SYSTEMMEMORY flag.
Look up DDSCAPS and DDSURFACEDESC in the DirectX SDK documentation for more information.
Hope this helps,
Qoy
You could use Targas. You can save those in 16bit color mode and they're simple to load. Plus, just about every art package (excluding Windows Paint :p) supports them.
--TheGoop
If I need to save space, I use DXTn compression (4-bits per pixel) if it doesn't degrade the image too much (usually not) and decompress at load-time, if necessary.
1-Create a compatible system DC with CreateCompatibleDC
2-Load the bitmap with LoadImage
3-Select the bitmap into the system dc
4-Create the surface with the proper dimensions
5-Get the DC of the surface with GetDC
6-BitBlt from the system dc onto the surfaces dc
7-release the surface dc, reselect into the system dc the old image, destroy the bitmap, and destroy the system dc
code://the codeHDC sysdc=CreateCompatibleDC(NULL);HBITMAP hbmnew=LoadImage(NULL,"Bitmap1.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);HBITMAP hbmold=(HBITMAP)SelectObject(sysdc,hbmnew);BITMAP bmp;GetObject(hbmnew,sizeof(BITMAP),(LPVOID)&bmp);DDSURFACEDESC ddsd;memset(&ddsd,0,sizeof(DDSURFACEDESC));ddsd.dwSize=sizeof(DDSURFACEDESC);ddsd.dwFlags=DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;ddsd.dwWidth=bmp.bmWidth;ddsd.dwHeight=bmp.bmHeight;ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN;LPDIRECTDRAWSURFACE lpdds;lpdd->CreateSurface(&ddsd,&lpdds,NULL);HDC surfdc;lpdds->GetDC(&surfdc);BitBlt(surfdc,0,0,bmp.bmWidth,bmp.bmHeight,sysdc,0,0,SRCCOPY);lpdds->ReleaseDC(surfdc);SelectObject(sysdc,hbmold);DeleteObject(hbmnew);DeleteDC(sysdc);
None of the programs i have (neither Photoshop or paint shop pro) allow images to be 16 bit.
Of course, I could go up to 24 bit in the game - but my video card doesn't have enough onboard memory , or go down to 640x480 - which isn't a desirable option...
Anyone know of an art package that lets you use 16 bit? Or a way or creating a surface (i think) that isn't on the video card memory? (i have 64 meg ram but only 2 meg graphics card...)
I know this message probably should have gone in the Art section, but it seems that not many people frequent that board.
Thanks all,
Shifty Bastard