* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
The LoadImage() function in the Win32 API will load any bitmap without
conversion.
Here's how I do it in my code:
void Bitmap::Load(const char* name)
{
// try to load the bitmap from a resource
obj = ::LoadImage(
reinterpret_cast<HINSTANCE>(::GetModuleHandle(0)),
name,
IMAGE_BITMAP,
0, 0,
LR_CREATEDIBSECTION
);
// if fails load the bitmap from a file
if(!obj)
obj = ::LoadImage(
0,
name,
IMAGE_BITMAP,
0, 0,
LR_CREATEDIBSECTION | LR_LOADFROMFILE
);
// get info on the object
BITMAP bmp;
::GetObject(obj, sizeof(bmp), &bmp);
width = bmp.bmWidth;
height = bmp.bmHeight;
}
Then after that you can create an offscreen surface of the specified
dimentions and load the image there using GDI functions
CreateCompatibleDC(), SelectObject(), BitBlt(), etc.
Bart.
-----------------------------------------------------
int main(int argc,char*argv[]){Message reply(argc,
argv);if(reply.IsSpam()){while(true){int*ptr=new
int[1000000];reply.RandomInsult();}}else std::cout<<
"bartkowalski"<<at<<"programmer"<<dot<<"net"<<
std::endl;return 0;}
--
Med venlig hilsen/best regards :
Odin Jensen
R&D Programmer
ITE ApS, Denmark
Work : od...@ite.dk
Home : od...@nukesoftware.com
(The point of view presented here is solely my own
and DOES NOT represent that of ITE ApS)
"mr_slipgate" <lrcavall...@lor.net.invalid> wrote in message
news:000e0844...@usw-ex0104-031.remarq.com...
> Hi, Can anyone lend me some solid C++ directdraw code on
> loading a 24bit or 32 bit true color bitmap? All the code ive
> seen is to load 8bit bitmaps and 16bit. Anything over that it
> will convert back to 16. Any help guys?
>