亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dibapi.cpp

?? 圖像霍夫曼編碼顯示 目前只支持256色圖像的顯示
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
    } 
    else 
    { 
        SetCursor(LoadCursor(NULL, IDC_ARROW)); 
        return NULL; 
    } 
} 
 
 
/************************************************************************* 
 * 
 * SaveDIB() 
 * 
 * Saves the specified DIB into the specified file name on disk.  No 
 * error checking is done, so if the file already exists, it will be 
 * written over. 
 * 
 * Parameters: 
 * 
 * HDIB hDib - Handle to the dib to save 
 * 
 * LPCTSTR lpFileName - pointer to full pathname to save DIB under 
 * 
 * Return value: TRUE if successful
 *				 FALSE if failure
 * 
 *************************************************************************/ 
BOOL SaveDIB(HDIB hDib, LPCTSTR lpFileName) 
{ 
    BITMAPFILEHEADER    bmfHdr;     // Header for Bitmap file 
    LPBITMAPINFOHEADER  lpBI;       // Pointer to DIB info structure 
    HANDLE              fh;         // file handle for opened file 
    DWORD               dwDIBSize; 
    DWORD               dwWritten; 
 
    if (!hDib) 
        return FALSE; 
 
    fh = CreateFile(lpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 
            FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); 
 
    if (fh == INVALID_HANDLE_VALUE) 
        return FALSE; 
 
    // Get a pointer to the DIB memory, the first of which contains 
    // a BITMAPINFO structure 
 
    lpBI = (LPBITMAPINFOHEADER)GlobalLock(hDib); 
    if (!lpBI) 
    { 
        CloseHandle(fh); 
        return FALSE; 
    } 
 
    // Check to see if we're dealing with an OS/2 DIB.  If so, don't 
    // save it because our functions aren't written to deal with these 
    // DIBs. 
 
    if (lpBI->biSize != sizeof(BITMAPINFOHEADER)) 
    { 
        GlobalUnlock(hDib); 
        CloseHandle(fh); 
        return FALSE; 
    } 
 
    // Fill in the fields of the file header 
 
    // Fill in file type (first 2 bytes must be "BM" for a bitmap) 
 
    bmfHdr.bfType = DIB_HEADER_MARKER;  // "BM" 
 
    // Calculating the size of the DIB is a bit tricky (if we want to 
    // do it right).  The easiest way to do this is to call GlobalSize() 
    // on our global handle, but since the size of our global memory may have 
    // been padded a few bytes, we may end up writing out a few too 
    // many bytes to the file (which may cause problems with some apps, 
    // like HC 3.0). 
    // 
    // So, instead let's calculate the size manually. 
    // 
    // To do this, find size of header plus size of color table.  Since the 
    // first DWORD in both BITMAPINFOHEADER and BITMAPCOREHEADER conains 
    // the size of the structure, let's use this. 
 
    // Partial Calculation 
 
    dwDIBSize = *(LPDWORD)lpBI + PaletteSize((LPBYTE)lpBI);   
 
    // Now calculate the size of the image 
 
    // It's an RLE bitmap, we can't calculate size, so trust the biSizeImage 
    // field 
 
    if ((lpBI->biCompression == BI_RLE8) || (lpBI->biCompression == BI_RLE4)) 
        dwDIBSize += lpBI->biSizeImage; 
    else 
    { 
        DWORD dwBmBitsSize;  // Size of Bitmap Bits only 
 
        // It's not RLE, so size is Width (DWORD aligned) * Height 
 
        dwBmBitsSize = WIDTHBYTES((lpBI->biWidth)*((DWORD)lpBI->biBitCount)) * 
                lpBI->biHeight; 
 
        dwDIBSize += dwBmBitsSize; 
 
        // Now, since we have calculated the correct size, why don't we 
        // fill in the biSizeImage field (this will fix any .BMP files which  
        // have this field incorrect). 
 
        lpBI->biSizeImage = dwBmBitsSize; 
    } 
 
 
    // Calculate the file size by adding the DIB size to sizeof(BITMAPFILEHEADER) 
                    
    bmfHdr.bfSize = dwDIBSize + sizeof(BITMAPFILEHEADER); 
    bmfHdr.bfReserved1 = 0; 
    bmfHdr.bfReserved2 = 0; 
 
    // Now, calculate the offset the actual bitmap bits will be in 
    // the file -- It's the Bitmap file header plus the DIB header, 
    // plus the size of the color table. 
     
    bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + lpBI->biSize + 
            PaletteSize((LPBYTE)lpBI); 
 
    // Write the file header 
 
    WriteFile(fh, (LPBYTE)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL); 
 
    // Write the DIB header and the bits -- use local version of 
    // MyWrite, so we can write more than 32767 bytes of data 
     
    WriteFile(fh, (LPBYTE)lpBI, dwDIBSize, &dwWritten, NULL); 
 
    GlobalUnlock(hDib); 
    CloseHandle(fh); 
 
    if (dwWritten == 0) 
        return FALSE; // oops, something happened in the write 
    else 
        return TRUE; // Success code 
} 
 
/************************************************************************* 
 * 
 * FindDIBBits() 
 * 
 * Parameter: 
 * 
 * LPBYTE lpDIB      - pointer to packed-DIB memory block 
 * 
 * Return Value: 
 * 
 * LPBYTE            - pointer to the DIB bits 
 * 
 * Description: 
 * 
 * This function calculates the address of the DIB's bits and returns a 
 * pointer to the DIB bits. 
 * 
 ************************************************************************/ 
LPBYTE FindDIBBits(LPBYTE lpDIB) 
{ 
   return (lpDIB + *(LPDWORD)lpDIB + PaletteSize(lpDIB)); 
} 
 
/************************************************************************* 
 * 
 * DIBWidth() 
 * 
 * Parameter: 
 * 
 * LPBYTE lpDIB      - pointer to packed-DIB memory block 
 * 
 * Return Value: 
 * 
 * DWORD            - width of the DIB 
 * 
 * Description: 
 * 
 * This function gets the width of the DIB from the BITMAPINFOHEADER 
 * width field if it is a Windows 3.0-style DIB or from the BITMAPCOREHEADER 
 * width field if it is an OS/2-style DIB. 
 * 
 ************************************************************************/ 
DWORD DIBWidth(LPBYTE lpDIB) 
{ 
    LPBITMAPINFOHEADER   lpbmi;  // pointer to a Win 3.0-style DIB 
    LPBITMAPCOREHEADER   lpbmc;  // pointer to an OS/2-style DIB 
 
    // point to the header (whether Win 3.0 and OS/2) 
 
    lpbmi = (LPBITMAPINFOHEADER)lpDIB; 
    lpbmc = (LPBITMAPCOREHEADER)lpDIB; 
 
    // return the DIB width if it is a Win 3.0 DIB 
 
    if (lpbmi->biSize == sizeof(BITMAPINFOHEADER)) 
        return lpbmi->biWidth; 
    else  // it is an OS/2 DIB, so return its width 
        return (DWORD)lpbmc->bcWidth; 
} 
 
DWORD DIBWidth(HDIB hDIB) 
{ 
	LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB);
	DWORD dw = DIBWidth(lpDIB);
	GlobalUnlock(hDIB);
	return dw;
} 
 
/************************************************************************* 
 * 
 * DIBHeight() 
 * 
 * Parameter: 
 * 
 * LPBYTE lpDIB      - pointer to packed-DIB memory block 
 * 
 * Return Value: 
 * 
 * DWORD            - height of the DIB 
 * 
 * Description: 
 * 
 * This function gets the height of the DIB from the BITMAPINFOHEADER 
 * height field if it is a Windows 3.0-style DIB or from the BITMAPCOREHEADER 
 * height field if it is an OS/2-style DIB. 
 * 
 ************************************************************************/ 
DWORD DIBHeight(LPBYTE lpDIB) 
{ 
   LPBITMAPINFOHEADER   lpbmi;  // pointer to a Win 3.0-style DIB 
   LPBITMAPCOREHEADER   lpbmc;  // pointer to an OS/2-style DIB 
 
   // point to the header (whether OS/2 or Win 3.0 
 
   lpbmi = (LPBITMAPINFOHEADER)lpDIB; 
   lpbmc = (LPBITMAPCOREHEADER)lpDIB; 
 
    // return the DIB height if it is a Win 3.0 DIB 
    if (lpbmi->biSize == sizeof(BITMAPINFOHEADER)) 
        return lpbmi->biHeight; 
    else  // it is an OS/2 DIB, so return its height 
        return (DWORD)lpbmc->bcHeight; 
} 
 
DWORD DIBHeight(HDIB hDIB) 
{ 
	LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB);
	DWORD dw = DIBHeight(lpDIB);
	GlobalUnlock(hDIB);
	return dw;
} 
 
/************************************************************************* 
 * 
 * PaletteSize() 
 * 
 * Parameter: 
 * 
 * LPBYTE lpDIB      - pointer to packed-DIB memory block 
 * 
 * Return Value: 
 * 
 * WORD             - size of the color palette of the DIB 
 * 
 * Description: 
 * 
 * This function gets the size required to store the DIB's palette by 
 * multiplying the number of colors by the size of an RGBQUAD (for a 
 * Windows 3.0-style DIB) or by the size of an RGBTRIPLE (for an OS/2- 
 * style DIB). 
 * 
 ************************************************************************/ 
WORD PaletteSize(LPBYTE lpDIB) 
{ 
    // calculate the size required by the palette 
    if (IS_WIN30_DIB (lpDIB)) 
        return (DIBNumColors(lpDIB) * sizeof(RGBQUAD)); 
    else 
        return (DIBNumColors(lpDIB) * sizeof(RGBTRIPLE)); 
} 
 
WORD PaletteSize(HDIB hDIB) 
{ 
	LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB);
	WORD wSize = PaletteSize(lpDIB);
	GlobalUnlock(hDIB);
	return wSize;
} 
 
/************************************************************************* 
 * 
 * DIBNumColors() 
 * 
 * Parameter: 
 * 
 * LPBYTE lpDIB      - pointer to packed-DIB memory block 
 * 
 * Return Value: 
 * 
 * WORD             - number of colors in the color table 
 * 
 * Description: 
 * 
 * This function calculates the number of colors in the DIB's color table 
 * by finding the bits per pixel for the DIB (whether Win3.0 or OS/2-style 
 * DIB). If bits per pixel is 1: colors=2, if 4: colors=16, if 8: colors=256, 
 * if 24, no colors in color table. 
 * 
 ************************************************************************/ 
WORD DIBNumColors(LPBYTE lpDIB) 
{ 
    WORD wBitCount;  // DIB bit count 
 
    // If this is a Windows-style DIB, the number of colors in the 
    // color table can be less than the number of bits per pixel 
    // allows for (i.e. lpbi->biClrUsed can be set to some value). 
    // If this is the case, return the appropriate value. 
     
 
    if (IS_WIN30_DIB(lpDIB)) 
    { 
        DWORD dwClrUsed; 
 
        dwClrUsed = ((LPBITMAPINFOHEADER)lpDIB)->biClrUsed; 
        if (dwClrUsed) 
 
        return (WORD)dwClrUsed; 
    } 
 
    // Calculate the number of colors in the color table based on 
    // the number of bits per pixel for the DIB. 
     
    if (IS_WIN30_DIB(lpDIB)) 
        wBitCount = ((LPBITMAPINFOHEADER)lpDIB)->biBitCount; 
    else 
        wBitCount = ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount; 
 
    // return number of colors based on bits per pixel 
 
    switch (wBitCount) 
    { 
        case 1: 
            return 2; 
 
        case 4: 
            return 16; 
 
        case 8: 
            return 256; 
 
        default: 
            return 0; 
    } 
} 

WORD DIBNumColors(HDIB hDIB) 
{ 
	LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB);
	WORD wSize = DIBNumColors(lpDIB);
	GlobalUnlock(hDIB);
	return wSize;
} 

WORD DIBBitCount(LPBYTE lpDIB) 
{ 
    if (IS_WIN30_DIB(lpDIB)) 
        return ((LPBITMAPINFOHEADER)lpDIB)->biBitCount; 
    else 
        return ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount; 
} 

WORD DIBBitCount(HDIB hDIB) 
{ 
	LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB);
	WORD wSize = DIBBitCount(lpDIB);
	GlobalUnlock(hDIB);
	return wSize;
} 
 
/**************************************************************************** 
* 
*     FUNCTION: BytesPerLine 
* 
*     PURPOSE:  Calculates the number of bytes in one scan line. 
* 
*     PARAMS:   LPBYTE lpDIB - pointer to the BITMAPINFOHEADER 
                              that begins the CF_DIB block 
* 
*     RETURNS:  DWORD - number of bytes in one scan line (DWORD aligned) 
* 
\****************************************************************************/ 
DWORD BytesPerLine(LPBYTE lpDIB) 
{ 
    return WIDTHBYTES(((LPBITMAPINFOHEADER)lpDIB)->biWidth * ((LPBITMAPINFOHEADER)lpDIB)->biPlanes * ((LPBITMAPINFOHEADER)lpDIB)->biBitCount); 
} 

DWORD BytesPerLine(HDIB hDIB) 
{ 
	LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB);
	DWORD dw = BytesPerLine(lpDIB);
	GlobalUnlock(hDIB);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲三级视频在线观看| 精品入口麻豆88视频| 亚洲精品福利视频网站| 粉嫩av一区二区三区在线播放| 久久亚洲精华国产精华液 | 99久久婷婷国产精品综合| 中文字幕第一区第二区| 99久久国产综合精品女不卡| 亚洲精品日日夜夜| 欧美日韩一区三区四区| 麻豆精品新av中文字幕| 国产亚洲一区二区三区四区| 成人黄色777网| 亚洲一二三四久久| 日韩视频一区二区三区在线播放| 国产一区二区看久久| 亚洲你懂的在线视频| 91精品国产麻豆| 粉嫩嫩av羞羞动漫久久久 | 久久精品免费在线观看| 91丨porny丨国产入口| 亚洲1区2区3区视频| 久久久天堂av| 欧美亚洲日本国产| 国产综合成人久久大片91| 亚洲欧美偷拍三级| 精品欧美乱码久久久久久1区2区 | 不卡av免费在线观看| 亚洲国产视频网站| 国产亚洲综合色| 欧美视频一区二区三区在线观看| 久久草av在线| 亚洲综合成人在线| 久久天堂av综合合色蜜桃网| 欧美亚洲禁片免费| 成人手机电影网| 麻豆成人av在线| 亚洲精品欧美激情| 久久久久久97三级| 欧美精品国产精品| 99精品国产一区二区三区不卡| 久久精品国产精品亚洲综合| 亚洲精品少妇30p| 日本一区二区三区视频视频| 7777精品久久久大香线蕉 | 精品一区二区三区在线播放视频| 亚洲欧美乱综合| 久久蜜桃av一区精品变态类天堂 | 日韩精品视频网| 亚洲视频中文字幕| 日本一区二区在线不卡| 欧美一级片在线| 欧美日韩视频在线一区二区| 粉嫩在线一区二区三区视频| 免费观看成人av| 午夜视频久久久久久| 玉足女爽爽91| 国产精品久久毛片a| 久久久综合视频| 日韩亚洲欧美综合| 制服丝袜中文字幕亚洲| 欧美三级三级三级| 日本高清无吗v一区| 91丝袜高跟美女视频| 成人av集中营| 国产剧情一区二区| 国产综合色视频| 国模冰冰炮一区二区| 久久99热国产| 久久国产精品无码网站| 男男gaygay亚洲| 麻豆免费精品视频| 久久精品国产成人一区二区三区| 日本不卡一区二区三区高清视频| 亚洲成人精品一区二区| 天天综合色天天综合| 亚洲成av人片观看| 婷婷夜色潮精品综合在线| 香蕉成人啪国产精品视频综合网| 亚洲制服欧美中文字幕中文字幕| 亚洲一区二区三区四区在线| 亚洲国产欧美日韩另类综合| 天堂午夜影视日韩欧美一区二区| 丝袜美腿亚洲色图| 麻豆精品一区二区av白丝在线| 另类小说综合欧美亚洲| 韩日av一区二区| 成人黄色综合网站| 一本一道久久a久久精品| 欧美在线制服丝袜| 欧美一区午夜视频在线观看| 欧美大片一区二区| 久久精品在线免费观看| 国产精品视频免费看| 又紧又大又爽精品一区二区| 亚洲成人先锋电影| 经典一区二区三区| 成人黄页在线观看| 欧美日韩成人在线一区| 精品日韩欧美一区二区| 国产精品毛片久久久久久| 亚洲另类在线一区| 免费美女久久99| 国产 欧美在线| 色狠狠色噜噜噜综合网| 日韩免费高清av| 中文字幕欧美日韩一区| 午夜久久久久久久久久一区二区| 国产一区二区三区四| 色哟哟精品一区| 欧美大片国产精品| 亚洲精品国产视频| 美女精品自拍一二三四| 91在线porny国产在线看| 欧美一区二区三区不卡| 欧美激情在线看| 日本最新不卡在线| av网站一区二区三区| 日韩精品一区二| 亚洲靠逼com| 国产中文字幕一区| 欧美性色黄大片| 国产性做久久久久久| 日韩和欧美一区二区三区| 成人污视频在线观看| 日韩午夜激情免费电影| 亚洲青青青在线视频| 国产精品一区二区在线看| 欧美日韩另类一区| 亚洲天堂中文字幕| 国产米奇在线777精品观看| 欧美丝袜丝交足nylons| 中文字幕一区二区三区蜜月 | 亚洲一区二区三区四区在线| 国产伦理精品不卡| 3d动漫精品啪啪| 尤物在线观看一区| 9人人澡人人爽人人精品| 欧美大胆一级视频| 天天色天天操综合| 日本韩国欧美国产| 亚洲欧美综合网| 国产成人精品aa毛片| 欧美成人在线直播| 免费看日韩精品| 在线播放国产精品二区一二区四区 | 亚洲自拍都市欧美小说| 不卡视频一二三| 国产午夜一区二区三区| 美日韩一级片在线观看| 欧美日本韩国一区| 亚洲一区二区精品久久av| 91污在线观看| 中文字幕一区二区不卡| 成人精品在线视频观看| 日本一区二区电影| 国产 欧美在线| 中文无字幕一区二区三区| 国产经典欧美精品| 久久久精品中文字幕麻豆发布| 玖玖九九国产精品| 精品国产伦一区二区三区免费| 美国一区二区三区在线播放| 日韩欧美一区二区免费| 久久国产精品99久久久久久老狼| 欧美一区二区三区视频免费| 丝袜美腿亚洲色图| 日韩一级片在线观看| 奇米色777欧美一区二区| 欧美一区二区三区在线电影| 蜜臀av国产精品久久久久| 日韩精品一区二| 国产精品综合av一区二区国产馆| 久久综合九色综合欧美亚洲| 国产乱码字幕精品高清av| 中文字幕精品—区二区四季| 成人av免费在线| 亚洲综合在线第一页| 3atv在线一区二区三区| 激情偷乱视频一区二区三区| 久久亚洲免费视频| 不卡视频在线观看| 亚洲自拍偷拍麻豆| 日韩欧美中文字幕公布| 国产福利一区二区| 亚洲另类在线制服丝袜| 欧美性受xxxx黑人xyx| 麻豆精品在线播放| 国产精品毛片久久久久久| 色琪琪一区二区三区亚洲区| 午夜精品福利久久久| 2021中文字幕一区亚洲| 99精品国产91久久久久久| 亚洲国产另类av| 精品88久久久久88久久久 | 色国产综合视频| 日本欧美在线观看| 日本一区二区三区四区在线视频 | 国产成人精品免费视频网站| 亚洲精品一二三|