用DirectX接口加载位图

// load the 24-bit image
if (!Load_Bitmap_File(&bitmap8bit,"rob.bmp"))
	return(0);

back_buffer = DDraw_Lock_Back_Surface();

BITMAP_IMAGE rob_img;

Create_Bitmap(&rob_img, 0, 0, 400, 400, 8);
Load_Image_Bitmap(&rob_img, &bitmap8bit, 0, 0, BITMAP_EXTRACT_MODE_ABS);
if(!Draw_Bitmap(&rob_img, back_buffer, back_lpitch, 0))
	return (0);

if(!DDraw_Unlock_Back_Surface())
	return (0);

Destroy_Bitmap(&rob_img);
Unload_Bitmap_File(&bitmap8bit);

// flip the surfaces
DDraw_Flip();

你可能感兴趣的:(用DirectX接口加载位图)