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

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

?? dibapi.cpp

?? 該程序實現了jpeg編碼。開發平臺:Window XP
?? 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一区二区三区免费野_久草精品视频
不卡av在线网| 蜜臀久久99精品久久久画质超高清 | 蜜桃视频在线一区| 欧美日韩精品是欧美日韩精品| 一区二区三区在线视频观看| 欧美日韩在线直播| 日本女人一区二区三区| 精品国产不卡一区二区三区| 国产在线一区二区| 国产精品久久久久影院| 色婷婷亚洲综合| 天堂成人免费av电影一区| 日韩三级视频在线观看| 国产精品一二一区| 亚洲欧美日韩国产另类专区| 欧美日韩一区二区三区不卡| 日本美女视频一区二区| 国产亚洲精品中文字幕| 色网站国产精品| 蜜桃91丨九色丨蝌蚪91桃色| 国产欧美一二三区| 欧洲日韩一区二区三区| 久久精品二区亚洲w码| 欧美激情在线一区二区三区| 在线精品视频一区二区三四| 日日骚欧美日韩| 久久精品免视看| 色偷偷久久一区二区三区| 麻豆91在线观看| 国产精品盗摄一区二区三区| 777奇米四色成人影色区| 国产成人午夜精品影院观看视频| 亚洲精品免费在线播放| 精品裸体舞一区二区三区| 91亚洲永久精品| 麻豆国产一区二区| 亚洲精品va在线观看| 欧美成人r级一区二区三区| 99久免费精品视频在线观看| 日韩av中文在线观看| 国产精品久久夜| 日韩欧美精品在线| 91小视频在线观看| 激情欧美一区二区| 天天综合色天天综合色h| 欧美激情一区二区在线| 欧美一区二区三区人| 色噜噜狠狠色综合欧洲selulu | 久久66热偷产精品| 亚洲精品成a人| 国产精品美女久久久久aⅴ| 日韩一区二区视频| 欧美四级电影网| eeuss鲁一区二区三区| 久久成人av少妇免费| 无吗不卡中文字幕| 亚洲裸体xxx| 国产精品久久久久四虎| 久久奇米777| 精品999在线播放| 欧美日韩mp4| 欧美亚洲愉拍一区二区| av在线不卡网| 成人午夜在线视频| 国产激情91久久精品导航 | 亚洲乱码国产乱码精品精小说| 久久久99精品久久| 精品国产欧美一区二区| 欧美一区二区在线免费观看| 欧美午夜精品电影| 91丝袜国产在线播放| jlzzjlzz欧美大全| www.亚洲色图.com| 99久久99久久综合| 97超碰欧美中文字幕| 99久久精品国产麻豆演员表| 成人91在线观看| aa级大片欧美| 一本色道久久综合亚洲精品按摩| 99精品桃花视频在线观看| 9人人澡人人爽人人精品| 成人精品国产福利| 99久久99久久免费精品蜜臀| fc2成人免费人成在线观看播放 | 一区二区三区产品免费精品久久75| 1024成人网色www| 亚洲欧美日本韩国| 亚洲高清免费观看 | 欧洲日韩一区二区三区| 欧美三级中文字| 91精品久久久久久蜜臀| 欧美一级片在线看| 精品播放一区二区| 国产精品国产自产拍在线| 亚洲久草在线视频| 亚洲不卡一区二区三区| 首页综合国产亚洲丝袜| 精品中文字幕一区二区| 成人午夜激情视频| 欧美图区在线视频| 精品国产免费一区二区三区四区 | 91.com在线观看| 日韩区在线观看| 久久精品视频在线看| 综合欧美亚洲日本| 午夜不卡在线视频| 精品一区二区三区在线观看| 丁香激情综合五月| 欧美日韩免费在线视频| 欧美videos大乳护士334| 中文字幕欧美激情| 午夜不卡av在线| 国产黄色成人av| 欧美久久一区二区| 久久久国产精品不卡| 亚洲影视在线播放| 国产麻豆精品一区二区| 色婷婷亚洲精品| 欧美刺激午夜性久久久久久久| 国产精品久久久久一区二区三区| 午夜电影一区二区| 波多野结衣中文字幕一区二区三区| 欧美伊人久久久久久久久影院| 亚洲精品在线三区| 亚洲中国最大av网站| 国产真实乱对白精彩久久| 欧美日韩色综合| 国产精品久久久久久一区二区三区 | 欧美精品一区二区三| 亚洲精品免费电影| 国产一区二区h| 欧美巨大另类极品videosbest | 国产一区二区三区美女| 欧美日本高清视频在线观看| 国产欧美日韩亚州综合 | 老汉av免费一区二区三区| 91亚洲午夜精品久久久久久| 久久五月婷婷丁香社区| 五月天一区二区| 色婷婷一区二区| 国产精品美日韩| 国产久卡久卡久卡久卡视频精品| 欧美日韩午夜精品| 悠悠色在线精品| 成年人国产精品| 久久久www成人免费无遮挡大片| 亚洲国产一区二区视频| 色综合久久88色综合天天免费| 久久久久久久久伊人| 日韩精品福利网| 欧美日韩成人综合| 亚洲另类中文字| 99视频国产精品| 国产精品福利一区二区三区| 国产aⅴ综合色| 久久影音资源网| 精品亚洲欧美一区| 日韩欧美成人激情| 美女免费视频一区二区| 欧美一区二区日韩| 喷白浆一区二区| 欧美一区二区三区婷婷月色| 午夜日韩在线观看| 欧美日韩高清一区| 日韩av网站免费在线| 欧美精品自拍偷拍动漫精品| 亚洲国产裸拍裸体视频在线观看乱了 | 亚洲成av人影院| 精品视频一区三区九区| 亚洲一区国产视频| 欧美影视一区在线| 三级欧美在线一区| 欧美一区二区三区免费视频| 五月激情综合色| 日韩久久久精品| 激情久久久久久久久久久久久久久久| 日韩欧美aaaaaa| 国产精品一色哟哟哟| 中文字幕欧美激情一区| www.日韩精品| 亚洲一区在线播放| 日韩三级精品电影久久久 | av爱爱亚洲一区| 一区二区三区在线视频免费| 欧美影片第一页| 久久99精品久久久久久动态图| 精品国产乱码久久久久久老虎| 国产一区二区不卡| 亚洲三级视频在线观看| 欧美巨大另类极品videosbest| 美女尤物国产一区| 国产日产亚洲精品系列| 91亚洲午夜精品久久久久久| 亚洲成av人**亚洲成av**| 欧美mv日韩mv| 99久久综合99久久综合网站| 五月天一区二区三区| 国产三级久久久| 一本到不卡免费一区二区| 午夜精品久久久久久久|