开发者

Can we use png instead bitmap in GDI for bitblt?

HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, g_hbmBall)开发者_JAVA技巧;
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 :)


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜