zoukankan
html css js c++ java
获取位图尺寸
从 CBitmap类对象中获取位图尺寸我们可用GetBitmap()函数 。
//
变量bitmap是一个CBitmap类对象
BITMAP bm;
bitmap.GetBitmap(
&
bm );
bmWidth
=
bm.bmWidth;
bmHeight
=
bm.bmHeight;
如果你有一个 HBITMAP句柄,你可以将它附加到一个CBitmap类对象上,再用上述方法
获取尺寸
//
变量hBmp是一个HBITMAP句柄
BITMAP bm;
::GetObject( hBmp,
sizeof
( bm ),
&
bm );
bmWidth
=
bm.bmWidth;
bmHeight
=
bm.bmHeight;
从BMP位图文件中获取位图尺寸可用下述方法。
CFile file;
//
sBMPFileName是BMP位图文件名
if
(
!
file.Open( sBMPFileName, CFile::modeRead) )
return
;
BITMAPFILEHEADER bmfHeader;
//
读文件头
if
(file.Read((LPSTR)
&
bmfHeader,
sizeof
(bmfHeader))
!=
sizeof
(bmfHeader))
return
;
//
确定文件类型标记’BM’
if
(bmfHeader.bfType
!=
((WORD) (’M’
<<
8
)
|
’B’))
return
;
BITMAPINFOHEADER bmiHeader;
if
(file.Read((LPSTR)
&
bmiHeader,
sizeof
(bmiHeader))
!=
sizeof
(bmiHeader))
return
;
int
bmWidth
=
bmiHeader.biWidth;
int
bmHeight
=
bmiHeader.biHeight;
查看全文
相关阅读:
hdu 1272 小希的迷宫
hdu 1318 Palindromes
ANR traces中内存占用情况解读
请教会linux shell脚本的=~是什么意思?
kernel struct definition location
SecureCRT sysrq键设置
sysrq
Linux中断管理 (1)Linux中断管理机制【转】
Linux suspend 流程介绍(2)之 freeze task
Linux进程状态解析 之 R、S、D、T、Z、X (主要有三个状态)
原文地址:https://www.cnblogs.com/wqj1212/p/1052788.html
最新文章
k Sum II
BackPack 2
t_5_2_2
chapter4_t2
chapter4_t1
t_4_5_1
t_4_6_1
t_4_4_1
t_4_2_1
t_4_3_1
热门文章
chapter3_t2
chapter3_t1
hdu 1864 最大报销额
map
C
hdu 2153 仙人球的残影
hdu 5685 Problem A (逆元)
逆元
欧拉函数
深搜
Copyright © 2011-2022 走看看