tags:

views:

139

answers:

2
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, g_hbmBall);
GetObject(g_hbmBall, sizeof(bm), &bm);
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);

I've found that many games use bitmap for displaying animation . But can we use png instead ?

Because bitmap is quite big when i convert fron png ( 1kb -> 12kb in bitmap )

Thanks for reading this :)

+1  A: 

No, I don't think so, but GDI+ supports PNG among several other formats.

Marcelo Cantos
GDI+ supports PNG files by converting them to bitmaps when they're opened, so the asker would still face the size problem he mentions.
MusiGenesis
+2  A: 

No, you can't BitBlt with a PNG. BitBlt (which stands for "bit block transfer", by the way) is very fast, but it is basically just a simple memory copying routine. So the only way to BitBlt any image format other than an uncompressed bitmap is to first convert that format to a bitmap.

By the way, applications typically use bitmaps for animation because you don't want to increase your overall frame rendering time by having to uncompress your sprite images each time. Bitmaps are just an example of generally caching things in memory to improve performance.

MusiGenesis
thanks for great explaining mate :)
nXqd