bmpd不是只获取了bmp1位图的大小?为什么连位图的样子也获取了?

mirro187_ 2013-02-14 02:54:40

CClientDC rdc(this);
CDC dc1,dc2;
CBitmap bmp1,bmpd;
BITMAP bitmap;
bmp1.LoadBitmap(IDB_BITMAP);
bmp1.GetBitmap(&bitmap);
bmpd.CreateBitmap(bitmap.bmWidth,bitmap.bmHeight,1,bitmap.bmBitsPixel,NULL);

dc1.CreateCompatibleDC(&rdc);
dc1.SelectObject(&bmp1);

LPBYTE lpbts;
int ncount=0;
ncount=(bitmap.bmHeight*bitmap.bmWidthBytes);
lpbts=new BYTE[ncount];
bmp1.GetBitmapBits(ncount,lpbts);
bmpd.SetBitmapBits(ncount,lpbts);

...全文
9123 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
dubiousway 2013-02-14
  • 打赏
  • 举报
回复
bmp1.GetBitmap(&bitmap); //这里获取大小 bmpd.CreateBitmap(bitmap.bmWidth,bitmap.bmHeight,1,bitmap.bmBitsPixel,NULL); //建立相同大小的位图 LPBYTE lpbts; int ncount=0; ncount=(bitmap.bmHeight*bitmap.bmWidthBytes); lpbts=new BYTE[ncount]; bmp1.GetBitmapBits(ncount,lpbts); //这里获取位图的样子,就是各个向素值 bmpd.SetBitmapBits(ncount,lpbts); //复制向素值到新的位图bmpd

19,469

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧