Loading 24+32bit Bitmaps with DirectDraw

10 просмотров
Перейти к первому непрочитанному сообщению

mr_slipgate

не прочитано,
24 апр. 2000 г., 03:00:0024.04.2000
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

не прочитано,
25 апр. 2000 г., 03:00:0025.04.2000
> 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

не прочитано,
28 апр. 2000 г., 03:00:0028.04.2000
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 новых сообщений