Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Loading 24+32bit Bitmaps with DirectDraw

12 views
Skip to first unread message

mr_slipgate

unread,
Apr 24, 2000, 3:00:00 AM4/24/00
to
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?

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!


Bart

unread,
Apr 25, 2000, 3:00:00 AM4/25/00
to
> 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?

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;}

Odin Jensen

unread,
Apr 28, 2000, 3:00:00 AM4/28/00
to
Check our NukeDX lib at www.nukesoftware.com
Comes with full source.
Another cool class called backbuffer is available at Seaumus programming
page at www.longbowdigitalarts.com


--
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?
>

0 new messages