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

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

?? dibapi.cpp

?? 該程序實現(xiàn)了jpeg編碼。開發(fā)平臺:Window XP
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
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);
	return dw;
} 

/**************************************************************************** 
* 
*     FUNCTION: DIBlockSize 
* 
*     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 - DIB block size
* 
\****************************************************************************/ 
DWORD DIBlockSize(LPBYTE lpDIB)
{
	if (((LPBITMAPINFOHEADER)lpDIB)->biSizeImage == 0)
		((LPBITMAPINFOHEADER)lpDIB)->biSizeImage = BytesPerLine(lpDIB) * ((LPBITMAPINFOHEADER)lpDIB)->biHeight;
	return ((LPBITMAPINFOHEADER)lpDIB)->biSize + PaletteSize(lpDIB) + ((LPBITMAPINFOHEADER)lpDIB)->biSizeImage;
}

DWORD DIBlockSize(HDIB hDIB) 
{ 
	LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB);
	DWORD dw = DIBlockSize(lpDIB);
	GlobalUnlock(hDIB);
	return dw;
} 
 
/************************************************************************* 
 * 
 * CreateDIBPalette() 
 * 
 * Parameter: 
 * 
 * LPBYTE lpbi       - specifies the DIB 
 * 
 * Return Value: 
 * 
 * HPALETTE         - specifies the palette 
 * 
 * Description: 
 * 
 * This function creates a palette from a DIB by allocating memory for the 
 * logical palette, reading and storing the colors from the DIB's color table 
 * into the logical palette, creating a palette from this logical palette, 
 * and then returning the palette's handle. This allows the DIB to be 
 * displayed using the best possible colors (important for DIBs with 256 or 
 * more colors). 
 * 
 ************************************************************************/ 
HPALETTE CreateDIBPalette(LPBYTE lpbi) 
{ 
    LPLOGPALETTE        lpPal;          // pointer to a logical palette 
    HANDLE              hLogPal;        // handle to a logical palette 
    HPALETTE            hPal = NULL;    // handle to a palette 
    int                 i, wNumColors;  // loop index, number of colors in color table 
    LPBITMAPINFO        lpbmi;          // pointer to BITMAPINFO structure (Win3.0) 
    LPBITMAPCOREINFO    lpbmc;          // pointer to BITMAPCOREINFO structure (OS/2) 
    BOOL                bWinStyleDIB;   // Win3.0 DIB? 
 
    // if handle to DIB is invalid, return NULL 
 
    if (! lpbi) 
        return NULL; 
 
    // get pointer to BITMAPINFO (Win 3.0) 
 
    lpbmi = (LPBITMAPINFO)lpbi; 
 
    // get pointer to BITMAPCOREINFO (OS/2 1.x) 
 
    lpbmc = (LPBITMAPCOREINFO)lpbi; 
 
    // get the number of colors in the DIB  
 
    wNumColors = DIBNumColors(lpbi); 
 
    // is this a Win 3.0 DIB? 
 
    bWinStyleDIB = IS_WIN30_DIB(lpbi); 
    if (wNumColors) 
    { 
        // allocate memory block for logical palette 
 
        hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + 
                sizeof(PALETTEENTRY) * wNumColors); 
 
        // if not enough memory, clean up and return NULL 
 
        if (!hLogPal) 
            return NULL; 
 
        // lock memory block and get pointer to it 
 
        lpPal = (LPLOGPALETTE)GlobalLock(hLogPal); 
 
        // set version and number of palette entries 
 
        lpPal->palVersion = PALVERSION; 
        lpPal->palNumEntries = wNumColors; 
 
        // store RGB triples (if Win 3.0 DIB) or RGB quads (if OS/2 DIB) 
        // into palette 
         
        for (i = 0; i < wNumColors; i++) 
        { 
            if (bWinStyleDIB) 
            { 
                lpPal->palPalEntry[i].peRed = lpbmi->bmiColors[i].rgbRed; 
                lpPal->palPalEntry[i].peGreen = lpbmi->bmiColors[i].rgbGreen; 
                lpPal->palPalEntry[i].peBlue = lpbmi->bmiColors[i].rgbBlue; 
                lpPal->palPalEntry[i].peFlags = 0; 
            } 
            else 
            { 
                lpPal->palPalEntry[i].peRed = lpbmc->bmciColors[i].rgbtRed; 
                lpPal->palPalEntry[i].peGreen = lpbmc->bmciColors[i].rgbtGreen; 
                lpPal->palPalEntry[i].peBlue = lpbmc->bmciColors[i].rgbtBlue; 
                lpPal->palPalEntry[i].peFlags = 0; 
            } 
        } 
 
        // create the palette and get handle to it 
 
        hPal = CreatePalette(lpPal); 
 
        // cleanup
 
        GlobalUnlock(hLogPal); 
        GlobalFree(hLogPal); 
    } 
 
    // return handle to DIB's palette 
    return hPal; 
} 
 
/************************************************************************* 
 * 
 * CreateDIBPalette() 
 * 
 * Parameter: 
 * 
 * HDIB hDIB        - specifies the DIB 
 * 
 * Return Value: 
 * 
 * HPALETTE         - specifies the palette 
 * 
 * Description: 
 * 
 * This function creates a palette from a DIB by allocating memory for the 
 * logical palette, reading and storing the colors from the DIB's color table 
 * into the logical palette, creating a palette from this logical palette, 
 * and then returning the palette's handle. This allows the DIB to be 
 * displayed using the best possible colors (important for DIBs with 256 or 
 * more colors). 
 * 
 ************************************************************************/ 
HPALETTE CreateDIBPalette(HDIB hDIB) 
{ 
    HPALETTE            hPal = NULL;    // handle to a palette 
    LPBYTE               lpbi;           // pointer to packed-DIB 
 
    // if handle to DIB is invalid, return NULL 
 
    if (!hDIB) 
        return NULL; 
 
    // lock DIB memory block and get a pointer to it 
 
    lpbi = (LPBYTE)GlobalLock(hDIB); 
 
	hPal = CreateDIBPalette(lpbi);

	// Unlock hDIB
    GlobalUnlock(hDIB); 
 
    // return handle to DIB's palette 
    return hPal; 
} 
 
/************************************************************************* 
 * 
 * DIBToBitmap() 
 * 
 * Parameters: 
 * 
 * HDIB hDIB        - specifies the DIB to convert 
 * 
 * HPALETTE hPal    - specifies the palette to use with the bitmap 
 * 
 * Return Value: 
 * 
 * HBITMAP          - identifies the device-dependent bitmap 
 * 
 * Description: 
 * 
 * This function creates a bitmap from a DIB using the specified palette. 
 * If no palette is specified, default is used. 
 * 
 * NOTE: 
 * 
 * The bitmap returned from this funciton is always a bitmap compatible 
 * with the screen (e.g. same bits/pixel and color planes) rather than 
 * a bitmap with the same attributes as the DIB.  This behavior is by 
 * design, and occurs because this function calls CreateDIBitmap to 
 * do its work, and CreateDIBitmap always creates a bitmap compatible 
 * with the hDC parameter passed in (because it in turn calls 
 * CreateCompatibleBitmap). 
 * 
 * So for instance, if your DIB is a monochrome DIB and you call this 
 * function, you will not get back a monochrome HBITMAP -- you will 
 * get an HBITMAP compatible with the screen DC, but with only 2 
 * colors used in the bitmap. 
 * 
 * If your application requires a monochrome HBITMAP returned for a 
 * monochrome DIB, use the function SetDIBits(). 
 * 
 * Also, the DIBpassed in to the function is not destroyed on exit. This 
 * must be done later, once it is no longer needed. 
 * 
 ************************************************************************/ 
HBITMAP DIBToBitmap(HDIB hDIB, HPALETTE hPal) 
{ 
    LPBYTE       lpDIBHdr, lpDIBBits;  // pointer to DIB header, pointer to DIB bits 
    HBITMAP     hBitmap;            // handle to device-dependent bitmap 
    HDC         hDC;                    // handle to DC 
    HPALETTE    hOldPal = NULL;    // handle to a palette 
 
    // if invalid handle, return NULL  
 
    if (!hDIB) 
        return NULL; 
 
    // lock memory block and get a pointer to it 
 
    lpDIBHdr = (LPBYTE)GlobalLock(hDIB); 
 
    // get a pointer to the DIB bits 
 
    lpDIBBits = FindDIBBits(lpDIBHdr); 
 
    // get a DC  
 
    hDC = GetDC(NULL); 
    if (!hDC) 
    { 
        // clean up and return NULL 
        GlobalUnlock(hDIB); 
        return NULL; 
    } 
 
    // select and realize palette 
 
    if (hPal) 
	{
        hOldPal = SelectPalette(hDC, hPal, FALSE); 
	    RealizePalette(hDC); 
	}
 
    // create bitmap from DIB info and bits 
    hBitmap = CreateDIBitmap(hDC, 
							(LPBITMAPINFOHEADER)lpDIBHdr, 
							CBM_INIT, 
							lpDIBBits, 
							(LPBITMAPINFO)lpDIBHdr, 
							DIB_RGB_COLORS);
 
    // restore previous palette 
    if (hOldPal) 
        SelectPalette(hDC, hOldPal, FALSE); 
 
    // clean up 
    ReleaseDC(NULL, hDC); 
    GlobalUnlock(hDIB); 
 
    // return handle to the bitmap 
    return hBitmap; 
} 
 
 
/************************************************************************* 
 * 
 * BitmapToDIB() 
 * 
 * Parameters: 
 * 
 * HBITMAP hBitmap  - specifies the bitmap to convert 
 * 
 * HPALETTE hPal    - specifies the palette to use with the bitmap 
 * 
 * Return Value: 
 * 
 * HDIB             - identifies the device-dependent bitmap 
 * 
 * Description: 
 * 
 * This function creates a DIB from a bitmap using the specified palette. 
 * 
 ************************************************************************/ 
HDIB BitmapToDIB(HBITMAP hBitmap, HPALETTE hPal) 
{ 
    BITMAP              bm;         // bitmap structure 
    BITMAPINFOHEADER    bi;         // bitmap header 
    LPBITMAPINFOHEADER  lpbi;       // pointer to BITMAPINFOHEADER 
    DWORD               dwLen;      // size of memory block 
    HANDLE              hDIB, h;    // handle to DIB, temp handle 
    HDC                 hDC;        // handle to DC 
    WORD                biBits;     // bits per pixel 
 
    // check if bitmap handle is valid 
 
    if (!hBitmap) 
        return NULL; 
 
    // fill in BITMAP structure, return NULL if it didn't work 
 
    if (!GetObject(hBitmap, sizeof(bm), (LPBYTE)&bm)) 
        return NULL; 
 
    // if no palette is specified, use default palette 
 
    if (hPal == NULL) 
        hPal = (HPALETTE)GetStockObject(DEFAULT_PALETTE); 
 
    // calculate bits per pixel 
 
    biBits = bm.bmPlanes * bm.bmBitsPixel; 
 
    // make sure bits per pixel is valid 
 
    if (biBits <= 1) 
        biBits = 1; 
    else if (biBits <= 4) 
        biBits = 4; 
    else if (biBits <= 8) 
        biBits = 8; 
    else // if greater than 8-bit, force to 24-bit 
        biBits = 24; 
 
    // initialize BITMAPINFOHEADER 
 
    bi.biSize = sizeof(BITMAPINFOHEADER); 
    bi.biWidth = bm.bmWidth; 
    bi.biHeight = bm.bmHeight; 
    bi.biPlanes = 1; 
    bi.biBitCount = biBits; 
    bi.biCompression = BI_RGB; 
    bi.biSizeImage = 0; 
    bi.biXPelsPerMeter = 0; 
    bi.biYPelsPerMeter = 0; 
    bi.biClrUsed = 0; 
    bi.biClrImportant = 0; 
 
    // calculate size of memory block required to store BITMAPINFO 
 
    dwLen = bi.biSize + PaletteSize((LPBYTE)&bi); 
 
    // get a DC 
 
    hDC = GetDC(NULL); 
 
    // select and realize our palette 
 
    hPal = SelectPalette(hDC, hPal, FALSE); 
    RealizePalette(hDC); 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女视频第一区二区三区免费观看网站 | 精品久久久久香蕉网| 亚洲不卡在线观看| 91精品福利在线一区二区三区| 亚洲福利视频三区| 在线不卡a资源高清| 免费黄网站欧美| 久久看人人爽人人| 91亚洲男人天堂| 亚洲欧美日韩电影| 欧美色图免费看| 国内精品国产三级国产a久久| 久久久久国产精品人| 99久久精品国产一区| 亚洲国产欧美一区二区三区丁香婷| 欧美一区二区免费视频| 国产伦精品一区二区三区视频青涩 | 粉嫩aⅴ一区二区三区四区| 国产亚洲精品aa午夜观看| 成人精品视频网站| 洋洋成人永久网站入口| 欧美一区午夜精品| 成人激情午夜影院| 午夜成人在线视频| 久久久国产综合精品女国产盗摄| 91麻豆.com| 精油按摩中文字幕久久| √…a在线天堂一区| 9191久久久久久久久久久| 激情国产一区二区| 亚洲综合激情网| 欧美精品一区二区三区很污很色的 | av男人天堂一区| 日韩福利视频导航| 国产精品理伦片| 日韩欧美黄色影院| 91免费观看视频在线| 日韩av电影免费观看高清完整版 | 在线观看日韩毛片| 国内不卡的二区三区中文字幕| 亚洲手机成人高清视频| 91麻豆精品国产自产在线观看一区| 成人精品亚洲人成在线| 免费成人在线播放| 亚洲图片欧美视频| 国产精品久久久久精k8| 欧美成人一区二区三区片免费| 在线视频欧美区| 国产成人a级片| 精品一区精品二区高清| 亚洲综合一二三区| 中文字幕一区av| 欧美激情一区不卡| 国产视频一区在线观看| 欧美刺激脚交jootjob| 欧美高清一级片在线| 色丁香久综合在线久综合在线观看| 国产福利91精品一区二区三区| 日韩精品欧美精品| 午夜精品福利一区二区蜜股av| ...xxx性欧美| 国产精品白丝在线| 中文在线免费一区三区高中清不卡| 国产精品久久久久久久久免费丝袜 | 成人福利视频在线看| 精品在线播放免费| 久久97超碰国产精品超碰| 日韩va亚洲va欧美va久久| 亚洲高清一区二区三区| 亚洲精品日产精品乱码不卡| 国产精品久久久久一区二区三区| 欧美成人女星排行榜| 91精品国产综合久久精品性色| 在线欧美一区二区| 日本精品视频一区二区| 日本乱人伦aⅴ精品| 在线日韩一区二区| 欧美日韩在线三级| 欧美日韩国产综合草草| 欧美日韩国产另类不卡| 欧美精品在欧美一区二区少妇| 欧美图区在线视频| 欧美日韩卡一卡二| 日韩一区二区三免费高清| 91麻豆精品91久久久久久清纯| 欧美精品日韩一区| 欧美丰满少妇xxxbbb| 日韩一区二区影院| 欧美精品一区二区三区很污很色的| 日韩欧美电影一二三| 精品捆绑美女sm三区| 国产亚洲女人久久久久毛片| 国产精品美女www爽爽爽| 日韩毛片精品高清免费| 亚洲成人动漫av| 免费观看一级特黄欧美大片| 黄色资源网久久资源365| 国产精品一区二区久久不卡 | 欧美一区二区成人6969| 日韩美女在线视频 | 99v久久综合狠狠综合久久| 91黄色免费版| 欧美成人精品福利| 亚洲国产精品成人综合| 亚洲最大成人网4388xx| 日本在线不卡一区| 国产成人在线观看免费网站| 色综合久久天天综合网| 制服丝袜av成人在线看| 国产日韩影视精品| 亚洲一区二区3| 国产一区二区三区国产| 在线观看一区不卡| 久久综合精品国产一区二区三区| 国产精品伦理在线| 国产在线观看一区二区| 在线免费观看一区| 久久综合九色综合欧美98| 亚洲乱码中文字幕| 国产麻豆精品在线| 欧美日韩久久不卡| 中文字幕在线不卡一区 | 夜夜嗨av一区二区三区四季av | 精品视频在线视频| 久久一日本道色综合| 亚洲综合色噜噜狠狠| 国产大陆精品国产| 欧美精品乱人伦久久久久久| 国产三级一区二区三区| 午夜精品123| 色美美综合视频| 精品少妇一区二区三区在线播放 | 中文字幕不卡一区| 日韩国产在线观看一区| av综合在线播放| www国产成人| 日欧美一区二区| 色就色 综合激情| 国产亚洲综合av| 麻豆精品新av中文字幕| 在线观看日韩电影| 中文字幕在线免费不卡| 毛片av一区二区三区| 欧美色综合网站| 亚洲三级免费观看| 国产成人免费在线视频| 日韩免费成人网| 免费观看日韩av| 欧美日韩电影一区| 亚洲一区欧美一区| 色哟哟精品一区| 最新国产成人在线观看| 国产精品99精品久久免费| 精品欧美乱码久久久久久1区2区| 亚洲福利国产精品| 欧美亚洲综合色| 一区二区三区国产豹纹内裤在线| 波多野结衣91| 国产精品丝袜久久久久久app| 国产在线国偷精品免费看| 精品1区2区在线观看| 日本在线不卡一区| 欧美一级视频精品观看| 麻豆精品一区二区三区| 欧美变态tickling挠脚心| 免费成人美女在线观看.| 日韩精品专区在线影院观看| 不卡一区二区在线| 国产精品色哟哟| 不卡一二三区首页| 亚洲欧美一区二区久久 | 在线观看免费一区| 亚洲精品菠萝久久久久久久| 在线观看精品一区| 亚洲v中文字幕| 日韩午夜三级在线| 久99久精品视频免费观看| 亚洲精品在线免费播放| 国产一区二区不卡在线| 国产精品天天看| 91国模大尺度私拍在线视频| 有码一区二区三区| 91精品国产入口| 国产老肥熟一区二区三区| 国产精品视频一二| 欧美四级电影网| 美女视频网站黄色亚洲| 久久九九久久九九| 91在线porny国产在线看| 亚洲国产成人porn| 26uuu久久天堂性欧美| 9i看片成人免费高清| 亚洲va欧美va人人爽| 精品国产亚洲在线| 成人综合婷婷国产精品久久| 亚洲精品第1页| 日韩精品一区二区三区老鸭窝 | 国产剧情一区在线| 一区二区三区 在线观看视频| 91精品国产91久久久久久一区二区 |