欧美free性护士vide0shd,老熟女,一区二区三区,久久久久夜夜夜精品国产,久久久久久综合网天天,欧美成人护士h版

首頁綜合 正文
目錄

柚子快報邀請碼778899分享:數(shù)字圖像處理 8-圖像縮放

柚子快報邀請碼778899分享:數(shù)字圖像處理 8-圖像縮放

http://yzkb.51969.com/

其實,就是開辟一個zoomwidth,zoomheight的內(nèi)存,再分別賦值即可。

void CDib::Scale(float xZoom, float yZoom) { //指向原圖像指針 LPBYTE p_data = GetData(); //指向原像素的指針 LPBYTE lpSrc; //指向縮放圖像對應像素的指針 LPBYTE lpDst ; //像素在原DIB的坐標 LONG i; LONG j; //循環(huán)變量(像素在新圖中的坐標) LONG i0; LONG j0; //圖像的寬和高 LONG width = GetWidth(); LONG height = GetHeight(); //計算放縮后的圖像寬度和高度 LONG newWidth = (LONG)(width * xZoom + 0.5); LONG newHeight = (LONG)(height * yZoom + 0.5); LONG newLineBytes = (newWidth * 8 + 31) / 32 * 4; //暫時分配內(nèi)存,以保存新圖像 LPBYTE temp1 = new BYTE[newWidth * newHeight]; memset(temp1, (BYTE)255, newWidth * newHeight); int r, g, b; for (int i = 0; i < newWidth; i++) { for (int j = 0; j < newHeight; j++) { lpDst = (LPBYTE)temp1 + newWidth * j + i; int i0 = (i / xZoom + 0.5); int j0 = (j / yZoom + 0.5); if ((i0 >=0 ) && ( i0 < width) && (j0 >= 0) && (j0 < height)) { lpSrc = (LPBYTE)p_data + width * j0 + i0; *lpDst = *lpSrc; } } } m_pData = temp1; m_pBitmapInfoHeader->biWidth = newWidth; m_pBitmapInfoHeader->biHeight = newHeight;

} 構(gòu)造函數(shù)調(diào)用

CMy1_showbitmapView::CMy1_showbitmapView() { _cdib.LoadFile (“D:/Test/DataProcess/result.bmp”); _cdib.Scale(2.0, 2.0); } 如果改為0.5倍,即 _cdib.Scale(0.5, 0.5);

柚子快報邀請碼778899分享:數(shù)字圖像處理 8-圖像縮放

http://yzkb.51969.com/

文章鏈接

評論可見,查看隱藏內(nèi)容

本文內(nèi)容根據(jù)網(wǎng)絡資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。

轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。

本文鏈接:http://gantiao.com.cn/post/19220888.html

發(fā)布評論

您暫未設置收款碼

請在主題配置——文章設置里上傳

掃描二維碼手機訪問

文章目錄