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

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

?? dibapi.cpp

?? 圖像霍夫曼編碼顯示 目前只支持256色圖像的顯示
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
	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); 
 
        // if error getting handle to palette, clean up and return NULL 
 
        if (!hPal) 
        { 
            GlobalUnlock(hLogPal); 
            GlobalFree(hLogPal); 
            return NULL; 
        } 
    } 
 
    // 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); 
 
    // alloc memory block to store our bitmap 
 
    hDIB = GlobalAlloc(GHND, dwLen); 
 
    // if we couldn't get memory block 
 
    if (!hDIB) 
    { 
      // clean up and return NULL 
 
      SelectPalette(hDC, hPal, TRUE); 
      RealizePalette(hDC); 
      ReleaseDC(NULL, hDC); 
      return NULL; 
    } 
 
    // lock memory and get pointer to it 
 
    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB); 
 
    /// use our bitmap info. to fill BITMAPINFOHEADER 
 
    *lpbi = bi; 
 
    // call GetDIBits with a NULL lpBits param, so it will calculate the 
    // biSizeImage field for us     
 
    GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, NULL, (LPBITMAPINFO)lpbi, 
        DIB_RGB_COLORS); 
 
    // get the info. returned by GetDIBits and unlock memory block 
 
    bi = *lpbi; 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91一区二区三区在线观看| 日韩制服丝袜av| 丰满放荡岳乱妇91ww| 国产精一区二区三区| 国内精品嫩模私拍在线| 日韩一二三区不卡| 日韩丝袜美女视频| 白白色 亚洲乱淫| 成人午夜免费电影| 欧美综合久久久| 日韩一区二区在线免费观看| 亚洲成人动漫在线观看| 综合久久久久久| 日本视频一区二区三区| 色婷婷激情综合| 精品一区二区日韩| 视频在线观看一区| 欧美精品成人一区二区三区四区| 国产电影一区二区三区| 91国偷自产一区二区开放时间| 欧美亚洲愉拍一区二区| av欧美精品.com| 日韩高清在线观看| 日韩欧美国产综合| 日韩欧美综合在线| 日韩视频123| 一本大道综合伊人精品热热| 一区二区日韩av| 日韩不卡一区二区| 免费av网站大全久久| 久久精品一区二区| 亚洲激情校园春色| 黄色日韩网站视频| 国产美女精品在线| 亚洲在线成人精品| 色丁香久综合在线久综合在线观看| 欧美日韩日日夜夜| 欧美a级一区二区| 99精品热视频| 欧美一卡2卡三卡4卡5免费| 99国产欧美久久久精品| 欧美激情资源网| 亚洲老妇xxxxxx| 欧美一区二区日韩| 欧美日本在线播放| 制服丝袜成人动漫| 国产乱码精品1区2区3区| 欧美伊人久久久久久久久影院 | 精品一区二区日韩| 成人av资源网站| 久久99精品国产.久久久久 | 26uuu色噜噜精品一区| 久久99精品国产麻豆婷婷洗澡| 制服丝袜中文字幕一区| 奇米四色…亚洲| 国产日韩欧美a| 久久99精品视频| 日韩免费观看2025年上映的电影| 国产丝袜欧美中文另类| 日韩精品1区2区3区| 亚洲另类在线视频| 欧美亚洲丝袜传媒另类| 粗大黑人巨茎大战欧美成人| 久久精品国产亚洲aⅴ| 91国产成人在线| 视频一区二区三区入口| 在线不卡欧美精品一区二区三区| 91丨九色丨黑人外教| 久久午夜老司机| 天天av天天翘天天综合网| 欧美一级艳片视频免费观看| 成人综合在线观看| 婷婷国产v国产偷v亚洲高清| 成人免费av网站| 国产一区二区三区在线观看免费视频| 欧美日韩国产片| 精品久久久影院| 国产激情91久久精品导航| 99国产麻豆精品| 欧美一二三在线| 91精品国产综合久久蜜臀| 欧美三级一区二区| 久久久无码精品亚洲日韩按摩| 一本在线高清不卡dvd| 欧美一区在线视频| 韩国三级中文字幕hd久久精品| 成人免费av在线| 欧美亚洲日本一区| 欧美影院一区二区| 国产大片一区二区| 国产成人精品免费在线| 日韩一级黄色片| 久久综合九色综合97婷婷女人 | 日本伊人精品一区二区三区观看方式| 91亚洲资源网| 成人福利在线看| 93久久精品日日躁夜夜躁欧美| 色婷婷激情久久| 久久国产视频网| 日韩欧美国产一区二区在线播放| 91色婷婷久久久久合中文| 国产精品久久久久影院亚瑟| 视频一区视频二区中文| 777午夜精品免费视频| 日韩一区二区三区免费看| 欧美日韩在线直播| 亚洲精品一区二区三区福利| 国产又黄又大久久| 中文字幕不卡在线| 欧美在线观看18| 日韩一本二本av| 国产91精品在线观看| 美女国产一区二区| 国产精品国产三级国产aⅴ无密码| 日韩电影免费一区| 中文字幕一区二区三区乱码在线| 亚洲国产日韩在线一区模特| 欧美日韩高清一区二区| 国产精品香蕉一区二区三区| 色视频欧美一区二区三区| 久久精品av麻豆的观看方式| 国产精品视频免费看| 日韩欧美色综合| 日韩一区二区在线观看视频| 精品在线播放午夜| 日韩久久精品一区| 国产成人在线色| 亚洲激情图片qvod| 中日韩免费视频中文字幕| 国产精品一品视频| 免费日韩伦理电影| 国产精品动漫网站| 日韩高清在线不卡| 国产精品国产三级国产普通话99| 日韩视频在线观看一区二区| 国产精品资源网| 国内精品写真在线观看| 久久综合九色综合97婷婷女人 | 在线观看一区不卡| 成人三级在线视频| 在线这里只有精品| 在线观看亚洲专区| 久久综合av免费| 白白色 亚洲乱淫| 波多野结衣在线一区| 国产麻豆成人精品| 自拍偷在线精品自拍偷无码专区| 中国av一区二区三区| 久久伊99综合婷婷久久伊| 欧美精品一区二区三区久久久 | 欧美日韩亚洲综合一区| 99久久婷婷国产精品综合| 在线视频欧美精品| 欧美国产日韩a欧美在线观看| wwww国产精品欧美| 日韩免费成人网| 欧美二区三区91| 亚洲欧洲综合另类在线| 奇米888四色在线精品| 91.com视频| 国产日产欧产精品推荐色| 久久久99免费| 自拍偷拍国产精品| 欧美精品高清视频| 欧美日韩在线电影| 欧洲一区二区三区免费视频| 欧美一区二区三区精品| 国产精品99久| 亚洲素人一区二区| 欧美xxxxx牲另类人与| 精品少妇一区二区三区在线播放 | 日韩va欧美va亚洲va久久| 日本一区二区成人在线| 国产精品18久久久| 国产精品麻豆网站| 欧美性猛交一区二区三区精品 | 国产精品一区二区久久不卡| 国产精品情趣视频| 欧美日韩一区二区三区在线看| 免费在线欧美视频| 久久综合色鬼综合色| 波多野结衣中文字幕一区| 亚洲国产成人porn| 欧美一卡二卡在线观看| 不卡电影免费在线播放一区| 日韩成人精品视频| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 亚洲3atv精品一区二区三区| 久久嫩草精品久久久精品一| 琪琪一区二区三区| 国产日韩欧美精品电影三级在线| 成人免费高清视频| 欧美精品一区二区不卡| 久久99精品国产.久久久久| 亚洲精品国产a| 欧美在线视频不卡| av亚洲精华国产精华精华| 亚洲欧洲另类国产综合| 91在线视频官网| 成人av在线资源|