关于BITMAP和IMAGE

0

倒数第二行报错:C++ 没有与参数列表匹配的 重载函数 “putimage” 实例 参数类型为: (int, int, BITMAP)

已经更改为使用多字节字符集

#include "atlimage.h"
#include<graphics.h>
int main() {
	initgraph(800, 600, SHOWCONSOLE);
	CImage img;
	const char* srcFilePath = "image\\gif.gif";
	HRESULT ret = img.Load(srcFilePath);
	HBITMAP bitmap = img.Detach();
	BITMAP bm;
	GetObject(bitmap, sizeof(bm), &bm);
	putimage(0, 0, bm);
}
0

你没有说你的需求,我实在搞不懂你为什么要这么绕个大弯。

如果只是加载图片,不用这么麻烦,直接这样写就行:

#include <graphics.h>
#include <conio.h>

int main()
{
	initgraph(800, 600);
	const char* srcFilePath = "image\\gif.gif";
	IMAGE img;
	loadimage(&img, srcFilePath);
	putimage(0, 0, img);
	_getch();
	closegraph();
}
ava
慢羊羊

2020-4-2

技术讨论社区
相关提问