亚洲欧美第一页_禁久久精品乱码_粉嫩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麻豆精品国产91久久久使用方法 | 日韩黄色片在线观看| 欧美一区二区在线不卡| 色诱亚洲精品久久久久久| 久久久久9999亚洲精品| 欧美三级乱人伦电影| 欧洲av一区二区嗯嗯嗯啊| 日本一区二区三区在线观看| 色哟哟亚洲精品| 亚洲精品国产a| 欧美日韩一级大片网址| 精品奇米国产一区二区三区| 久久精品国产99国产精品| 在线精品国精品国产尤物884a| 国产女人aaa级久久久级 | 99久久精品免费看国产免费软件| 欧美一级日韩免费不卡| 亚洲国产中文字幕| 国产精品自拍在线| 精品国内二区三区| 国产在线国偷精品免费看| 欧美日韩在线三级| 天堂影院一区二区| 91麻豆免费看| 久久福利视频一区二区| 欧美国产一区视频在线观看| 东方aⅴ免费观看久久av| 亚洲欧洲精品天堂一级 | 精品系列免费在线观看| 精品国产1区2区3区| 看片的网站亚洲| 亚洲免费在线播放| 精品视频一区二区不卡| 青青草原综合久久大伊人精品优势 | 91在线观看污| 久久国产婷婷国产香蕉| 一区二区三区中文字幕精品精品 | 在线播放一区二区三区| 激情文学综合丁香| 亚洲一区二区视频在线观看| 欧美大尺度电影在线| 色偷偷88欧美精品久久久 | 久久久久久日产精品| 99久久精品免费看| 国产精品一级在线| 青青草原综合久久大伊人精品| 亚洲精品精品亚洲| 亚洲欧洲国产日韩| 国产精品无遮挡| 精品国产免费视频| 欧美成人a在线| 91麻豆国产在线观看| 床上的激情91.| 九色|91porny| 蜜臀av一区二区在线观看| 亚洲欧美日韩中文字幕一区二区三区 | 亚洲成a人在线观看| 亚洲男人天堂av| 中文字幕日韩一区二区| 国产精品免费久久| 中文字幕一区二区三区不卡在线| 欧美午夜电影网| 成人国产在线观看| 国产成人精品免费看| 成人一区二区视频| 粉嫩一区二区三区性色av| 国产一区二区导航在线播放| 日韩1区2区3区| 亚洲小说春色综合另类电影| 亚洲一区免费在线观看| 日韩午夜精品电影| 日韩欧美一级片| 欧美成人a∨高清免费观看| 日韩欧美国产一区二区三区| 日韩欧美一级二级三级久久久| 欧美精品一区男女天堂| 日韩欧美成人一区| 欧美男生操女生| 欧美v亚洲v综合ⅴ国产v| 久久午夜免费电影| 国产欧美一区二区精品忘忧草| 国产欧美日韩在线| 中文字幕五月欧美| 国产精品国模大尺度视频| 欧美成人精品福利| 欧美国产精品一区| 亚洲r级在线视频| 韩国av一区二区| 91一区二区在线| 色视频一区二区| 久久亚洲二区三区| 亚洲一区在线免费观看| 蜜臂av日日欢夜夜爽一区| 成人天堂资源www在线| 色999日韩国产欧美一区二区| 91精品国产欧美一区二区| 国产精品黄色在线观看| 麻豆精品久久久| 一本到三区不卡视频| 欧美日本一区二区在线观看| 久久久精品欧美丰满| 亚洲综合久久av| 风间由美中文字幕在线看视频国产欧美| 91福利国产精品| 国产精品青草久久| 九一九一国产精品| 欧美怡红院视频| 欧美成人精品福利| 午夜精品成人在线视频| 国产精品123区| 欧美一区二区三区在线观看视频| 亚洲精品日产精品乱码不卡| 国产精品综合久久| 欧美一卡2卡三卡4卡5免费| 亚洲婷婷在线视频| 国内精品免费在线观看| 欧美日韩国产首页| 一二三四区精品视频| 国产原创一区二区三区| 在线精品亚洲一区二区不卡| 欧美国产综合一区二区| 久久99久国产精品黄毛片色诱| 日本乱人伦一区| 综合久久给合久久狠狠狠97色| 日韩一区欧美二区| 欧美日韩国产综合一区二区 | 国产精品嫩草影院com| 日本欧美久久久久免费播放网| 欧美丝袜丝nylons| 亚洲欧洲中文日韩久久av乱码| 国产精品一二三区| 91麻豆精品国产综合久久久久久| 国产精品久久777777| 国产精品1区2区3区在线观看| 91精品欧美久久久久久动漫| 日韩精品欧美精品| 678五月天丁香亚洲综合网| 亚洲在线免费播放| 欧美日韩aaa| 亚洲1区2区3区4区| 日韩一级完整毛片| 国产在线精品一区二区三区不卡| 久久久久久久久一| 成人免费视频免费观看| 综合欧美亚洲日本| 欧美精品久久久久久久多人混战| 亚洲妇女屁股眼交7| 欧美人妖巨大在线| 精品中文av资源站在线观看| 久久精品综合网| 不卡电影一区二区三区| 亚洲另类一区二区| 在线观看91精品国产麻豆| 久久精品免费观看| 国产午夜精品一区二区三区四区| 成人av网站大全| 日韩精品电影在线观看| wwwwww.欧美系列| 91免费版在线看| 国产亚洲成av人在线观看导航| 色欧美乱欧美15图片| 同产精品九九九| 国产色爱av资源综合区| 97久久精品人人做人人爽| 亚瑟在线精品视频| 久久久欧美精品sm网站| 91蜜桃视频在线| 免费观看在线色综合| 中文字幕在线一区二区三区| 在线观看免费成人| 久久精品噜噜噜成人av农村| 亚洲欧洲av在线| 日韩欧美一区二区三区在线| 99在线精品观看| 国内外精品视频| 亚洲已满18点击进入久久| 久久久午夜电影| 4438x成人网最大色成网站| 成人午夜又粗又硬又大| 日日夜夜免费精品视频| 国产精品久久久久久久久晋中| 884aa四虎影成人精品一区| 99热精品国产| 国产成人综合精品三级| 天天做天天摸天天爽国产一区| 国产精品免费视频观看| 久久综合九色综合久久久精品综合| 在线观看亚洲精品| www.色综合.com| 国产激情一区二区三区桃花岛亚洲| 午夜av一区二区| 亚洲精品国产无套在线观| 国产精品欧美一级免费| 久久亚洲私人国产精品va媚药| 91精品国产综合久久久蜜臀图片| 色综合久久九月婷婷色综合| av电影一区二区| 成人黄色小视频在线观看|