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

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

?? dib.cpp

?? visual c++ 實例編程
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// Dib.cpp: implementation of the CDib class.
//////////////////////////////////////////////////////////////////////
//
//用途:IconSnap所需調用的類
//功能:DIB設備無關位圖基礎操作類
//作者:徐景周
//日期:2001年9月
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "IconSnap.h"
#include "Dib.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CDib::CDib()
{

}

CDib::~CDib()
{

}

/****************************************************************************
*
*     FUNCTION: FindDIBits
*
*     PURPOSE:  Locate the image bits in a CF_DIB format DIB.
*
*     PARAMS:   LPSTR lpbi - pointer to the CF_DIB memory block
*
*     RETURNS:  LPSTR - pointer to the image bits
*
*
\****************************************************************************/
LPSTR CDib::FindDIBBits( LPSTR lpbi )
{
   return ( lpbi + *(LPDWORD)lpbi + PaletteSize( lpbi ) );
}
/* End FindDIBits() *********************************************************/

/****************************************************************************
*
*     FUNCTION: DIBNumColors
*
*     PURPOSE:  Calculates the number of entries in the color table.
*
*     PARAMS:   LPSTR lpbi - pointer to the CF_DIB memory block
*
*     RETURNS:  WORD - Number of entries in the color table.
*
*
\****************************************************************************/
WORD CDib::DIBNumColors( LPSTR lpbi )
{
    WORD wBitCount;
    DWORD dwClrUsed;

    dwClrUsed = ((LPBITMAPINFOHEADER) lpbi)->biClrUsed;

    if (dwClrUsed)
        return (WORD) dwClrUsed;

    wBitCount = ((LPBITMAPINFOHEADER) lpbi)->biBitCount;

    switch (wBitCount)
    {
        case 1: return 2;
        case 4: return 16;
        case 8:	return 256;
        default:return 0;
    }
    return 0;
}
/* End DIBNumColors() ******************************************************/

/****************************************************************************
*
*     FUNCTION: PaletteSize
*
*     PURPOSE:  Calculates the number of bytes in the color table.
*
*     PARAMS:   LPSTR lpbi - pointer to the CF_DIB memory block
*
*     RETURNS:  WORD - number of bytes in the color table
*
*
\****************************************************************************/
WORD CDib::PaletteSize( LPSTR lpbi )
{
    return ( DIBNumColors( lpbi ) * sizeof( RGBQUAD ) );
}
/* End PaletteSize() ********************************************************/



/****************************************************************************
*
*     FUNCTION: BytesPerLine
*
*     PURPOSE:  Calculates the number of bytes in one scan line.
*
*     PARAMS:   LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER
*                                           that begins the CF_DIB block
*
*     RETURNS:  DWORD - number of bytes in one scan line (DWORD aligned)
*
*
\****************************************************************************/
DWORD CDib::BytesPerLine( LPBITMAPINFOHEADER lpBMIH )
{
    return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount);
}
/* End BytesPerLine() ********************************************************/

/****************************************************************************
*
*     FUNCTION: ConvertDIBFormat
*
*     PURPOSE:  Creates a new DIB of the requested format, copies the source
*               image to the new DIB.
*
*     PARAMS:   LPBITMAPINFO lpSrcDIB - the source CF_DIB
*               UINT         nWidth   - width for new DIB
*               UINT         nHeight  - height for new DIB
*               UINT         nbpp     - bpp for new DIB
*               BOOL         bStretch - TRUE to stretch source to dest
*                                       FALSE to take upper left of image
*
*     RETURNS:  LPBYTE - pointer to new CF_DIB memory block with new image
*               NULL on failure
*
*
\****************************************************************************/
LPBYTE CDib::ConvertDIBFormat( LPBITMAPINFO lpSrcDIB, UINT nWidth, UINT nHeight, UINT nbpp, BOOL bStretch )
{
    LPBITMAPINFO    lpbmi = NULL;
    LPBYTE        	lpSourceBits, lpTargetBits, lpResult;
    HDC            	hDC = NULL, hSourceDC, hTargetDC;
    HBITMAP        	hSourceBitmap, hTargetBitmap, hOldTargetBitmap, hOldSourceBitmap;
    DWORD        	dwSourceBitsSize, dwTargetBitsSize, dwTargetHeaderSize;

    // Allocate and fill out a BITMAPINFO struct for the new DIB
    // Allow enough room for a 256-entry color table, just in case
    dwTargetHeaderSize = sizeof( BITMAPINFO ) + ( 256 * sizeof( RGBQUAD ) );
    lpbmi = (LPBITMAPINFO)malloc( dwTargetHeaderSize );
    lpbmi->bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
    lpbmi->bmiHeader.biWidth = nWidth;
    lpbmi->bmiHeader.biHeight = nHeight;
    lpbmi->bmiHeader.biPlanes = 1;
    lpbmi->bmiHeader.biBitCount = nbpp;
    lpbmi->bmiHeader.biCompression = BI_RGB;
    lpbmi->bmiHeader.biSizeImage = 0;
    lpbmi->bmiHeader.biXPelsPerMeter = 0;
    lpbmi->bmiHeader.biYPelsPerMeter = 0;
    lpbmi->bmiHeader.biClrUsed = 0;
    lpbmi->bmiHeader.biClrImportant = 0;
    // Fill in the color table
    if( ! CopyColorTable( lpbmi, (LPBITMAPINFO)lpSrcDIB ) )
    {
        free( lpbmi );
        return NULL;
    }

    // Gonna use DIBSections and BitBlt() to do the conversion, so make 'em
    hDC = GetDC( NULL );
    hTargetBitmap = CreateDIBSection( hDC, lpbmi, DIB_RGB_COLORS, (void ** )&lpTargetBits, NULL, 0 );
    hSourceBitmap = CreateDIBSection( hDC, lpSrcDIB, DIB_RGB_COLORS,(void ** ) &lpSourceBits, NULL, 0 );
    hSourceDC = CreateCompatibleDC( hDC );
    hTargetDC = CreateCompatibleDC( hDC );

    // Flip the bits on the source DIBSection to match the source DIB
    dwSourceBitsSize = lpSrcDIB->bmiHeader.biHeight * BytesPerLine(&(lpSrcDIB->bmiHeader));
    dwTargetBitsSize = lpbmi->bmiHeader.biHeight * BytesPerLine(&(lpbmi->bmiHeader));
    memcpy( lpSourceBits, FindDIBBits((LPSTR)lpSrcDIB), dwSourceBitsSize );

    // Select DIBSections into DCs
    hOldSourceBitmap =(HBITMAP ) SelectObject( hSourceDC, hSourceBitmap );
    hOldTargetBitmap = (HBITMAP )SelectObject( hTargetDC, hTargetBitmap );

    // Set the color tables for the DIBSections
    if( lpSrcDIB->bmiHeader.biBitCount <= 8 )
        SetDIBColorTable( hSourceDC, 0, 1 << lpSrcDIB->bmiHeader.biBitCount, lpSrcDIB->bmiColors );
    if( lpbmi->bmiHeader.biBitCount <= 8 )
        SetDIBColorTable( hTargetDC, 0, 1 << lpbmi->bmiHeader.biBitCount, lpbmi->bmiColors );

    // If we are asking for a straight copy, do it
    if( (lpSrcDIB->bmiHeader.biWidth==lpbmi->bmiHeader.biWidth) && (lpSrcDIB->bmiHeader.biHeight==lpbmi->bmiHeader.biHeight) )
    {
        BitBlt( hTargetDC, 0, 0, lpbmi->bmiHeader.biWidth, lpbmi->bmiHeader.biHeight, hSourceDC, 0, 0, SRCCOPY );
    }
    else
    {
        // else, should we stretch it?
        if( bStretch )
        {
            SetStretchBltMode( hTargetDC, COLORONCOLOR );
            StretchBlt( hTargetDC, 0, 0, lpbmi->bmiHeader.biWidth, lpbmi->bmiHeader.biHeight, hSourceDC, 0, 0, lpSrcDIB->bmiHeader.biWidth, lpSrcDIB->bmiHeader.biHeight, SRCCOPY );
        }
        else
        {
            // or just take the upper left corner of the source
            BitBlt( hTargetDC, 0, 0, lpbmi->bmiHeader.biWidth, lpbmi->bmiHeader.biHeight, hSourceDC, 0, 0, SRCCOPY );
        }
    }

    // Clean up and delete the DCs
    SelectObject( hSourceDC, hOldSourceBitmap );
    SelectObject( hSourceDC, hOldTargetBitmap );
    DeleteDC( hSourceDC );
    DeleteDC( hTargetDC );
    ReleaseDC( NULL, hDC );

    // Flush the GDI batch, so we can play with the bits
    GdiFlush();

    // Allocate enough memory for the new CF_DIB, and copy bits
    lpResult =(LPBYTE ) malloc( dwTargetHeaderSize + dwTargetBitsSize );
    memcpy( lpResult, lpbmi, dwTargetHeaderSize );
    memcpy( FindDIBBits( (LPSTR)lpResult ), lpTargetBits, dwTargetBitsSize );

    // final cleanup
    DeleteObject( hTargetBitmap );
    DeleteObject( hSourceBitmap );
    free( lpbmi );

    return lpResult;
}
/* End ConvertDIBFormat() ***************************************************/

/****************************************************************************
*
*     FUNCTION: CopyColorTable
*
*     PURPOSE:  Copies the color table from one CF_DIB to another.
*
*     PARAMS:   LPBITMAPINFO lpTarget - pointer to target DIB
*               LPBITMAPINFO lpSource - pointer to source DIB
*
*     RETURNS:  BOOL - TRUE for success, FALSE for failure
*
*
\****************************************************************************/
BOOL CDib::CopyColorTable( LPBITMAPINFO lpTarget, LPBITMAPINFO lpSource )
{
    // What we do depends on the target's color depth
    switch( lpTarget->bmiHeader.biBitCount )
    {
        // 8bpp - need 256 entry color table
        case 8:
            if( lpSource->bmiHeader.biBitCount == 8 )
            { // Source is 8bpp too, copy color table
                memcpy( lpTarget->bmiColors, lpSource->bmiColors, 256*sizeof(RGBQUAD) );
                return TRUE;
            }
            else
            { // Source is != 8bpp, use halftone palette                
                HPALETTE        hPal;
                HDC            	hDC = GetDC( NULL );
                PALETTEENTRY    pe[256];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
丰满白嫩尤物一区二区| 日韩欧美精品三级| 日韩精品中文字幕一区二区三区 | 成人午夜碰碰视频| 欧美性色综合网| 中文字幕欧美国产| 久久激情五月激情| 欧美三级资源在线| 国产精品久久久久一区二区三区共| 日本视频在线一区| 欧美性色欧美a在线播放| 国产精品丝袜91| 国产自产v一区二区三区c| 91搞黄在线观看| 中文字幕视频一区| 国产成a人亚洲精品| 日韩欧美一区二区视频| 午夜精品久久久久影视| 色狠狠综合天天综合综合| 久久久噜噜噜久久中文字幕色伊伊 | 亚洲欧洲无码一区二区三区| 美国三级日本三级久久99| 欧美色偷偷大香| 一区二区久久久| 91在线观看一区二区| 国产精品免费视频网站| 国产高清精品在线| 久久综合九色综合欧美就去吻| 亚洲大尺度视频在线观看| 在线免费亚洲电影| 亚洲精选免费视频| 色欧美片视频在线观看在线视频| 国产精品久久久久久久午夜片| 国产精品99久久久久| 国产亚洲欧美一区在线观看| 韩日av一区二区| 日本一区二区三区在线不卡| 国产精品99久久久久久似苏梦涵 | 国产v综合v亚洲欧| 久久综合久久综合久久综合| 久久福利资源站| 欧美成人精品高清在线播放| 国精品**一区二区三区在线蜜桃| 亚洲精品一线二线三线无人区| 国产中文字幕精品| 国产欧美精品一区| 91年精品国产| 亚洲香肠在线观看| 日韩欧美国产精品一区| 国产自产v一区二区三区c| 中文字幕欧美日韩一区| 色美美综合视频| 性欧美大战久久久久久久久| 日韩欧美国产不卡| 国产a久久麻豆| 亚洲欧美国产三级| 欧美一区二区三区视频免费| 精品一区中文字幕| 国产精品久久免费看| 欧美视频中文字幕| 久久aⅴ国产欧美74aaa| 中文在线一区二区| 欧美性生活影院| 国产一区二区视频在线播放| 中文字幕一区二区在线观看| 884aa四虎影成人精品一区| 国产一区二区在线观看免费| 亚洲免费在线视频一区 二区| 欧美日韩中文精品| 国产精一区二区三区| 一区二区三区欧美视频| 精品国产一区a| 91香蕉视频黄| 国产一区中文字幕| 夜夜嗨av一区二区三区中文字幕 | 欧美精品视频www在线观看| 免费在线欧美视频| 日韩一区在线看| 欧美一卡二卡三卡| 成人综合婷婷国产精品久久| 日韩国产欧美三级| 亚洲日本va午夜在线影院| 日韩午夜小视频| 色偷偷久久人人79超碰人人澡| 久久99国产精品久久| 一区二区三区精品在线观看| 国产精品视频你懂的| 在线观看视频一区| 国产老妇另类xxxxx| 天堂午夜影视日韩欧美一区二区| 国产精品久久久久久久久图文区 | 日韩黄色免费电影| 国产亚洲一区二区三区在线观看| 欧美在线观看禁18| www.成人在线| 韩国一区二区三区| 日韩电影在线免费| 亚洲精品免费一二三区| 国产女人18毛片水真多成人如厕 | 日本欧美一区二区三区乱码| 中文文精品字幕一区二区| 精品美女一区二区| 欧美一区二区三区四区视频| 欧美在线视频不卡| 99国产欧美久久久精品| 成人亚洲一区二区一| 国产乱色国产精品免费视频| 蜜桃91丨九色丨蝌蚪91桃色| 午夜伊人狠狠久久| 亚洲福利视频导航| 亚洲成人自拍偷拍| 亚洲国产精品久久人人爱| 依依成人综合视频| 一区二区三区**美女毛片| 亚洲人成在线观看一区二区| 中文字幕一区二区三区在线观看 | 亚洲欧美经典视频| 亚洲欧洲制服丝袜| 一区二区三区中文字幕在线观看| 中文字幕一区二区三区乱码在线| 国产精品超碰97尤物18| 国产精品每日更新在线播放网址 | 精品国一区二区三区| 欧美成人vps| 精品国产欧美一区二区| 精品成人佐山爱一区二区| 欧美精品一区二区三区蜜桃| 精品第一国产综合精品aⅴ| 久久久国产精品麻豆| 国产精品午夜电影| 亚洲天堂av老司机| 亚洲国产日韩精品| 奇米888四色在线精品| 狠狠色丁香婷婷综合久久片| 国产盗摄女厕一区二区三区| 丰满白嫩尤物一区二区| 日本二三区不卡| 欧美日韩电影在线播放| 日韩精品一区二| 中文一区二区完整视频在线观看| 樱桃国产成人精品视频| 麻豆国产精品一区二区三区| 国产99久久久国产精品潘金| 97精品久久久久中文字幕| 欧美日韩一区 二区 三区 久久精品| 欧美一区二区三区色| 久久亚洲精品小早川怜子| 亚洲色图.com| 理论片日本一区| av激情亚洲男人天堂| 制服丝袜成人动漫| 国产欧美精品一区| 日日夜夜精品视频免费| 国产高清久久久久| 欧美精品乱码久久久久久按摩 | 亚洲另类春色校园小说| 日本免费新一区视频| 菠萝蜜视频在线观看一区| 欧美福利视频一区| 欧美激情一区二区在线| 视频在线观看91| 成人短视频下载| 91精品国产综合久久久蜜臀粉嫩| 欧美激情资源网| 日本欧美肥老太交大片| 成人激情视频网站| 欧美大片一区二区| 夜夜精品视频一区二区| 91视频在线观看| 精品国产凹凸成av人网站| 一区二区三区在线观看国产| 国产一区高清在线| 91.成人天堂一区| 亚洲人成精品久久久久久| 国产一区二三区| 3d动漫精品啪啪1区2区免费 | 五月天久久比比资源色| 成人av高清在线| 欧美不卡一区二区| 亚洲第一会所有码转帖| proumb性欧美在线观看| 久久久一区二区三区捆绑**| 日韩av成人高清| 色综合色狠狠综合色| 欧美激情一区二区三区蜜桃视频 | 亚洲在线中文字幕| 成人免费的视频| 国产亚洲欧洲一区高清在线观看| 久久狠狠亚洲综合| 日韩一区二区三区在线| 天天亚洲美女在线视频| 欧美性色黄大片| 亚洲1区2区3区视频| 欧洲一区二区三区在线| 亚洲丝袜精品丝袜在线| 99久久国产综合精品女不卡| 国产精品丝袜久久久久久app| 国产98色在线|日韩| 日本一区二区三区国色天香| 国产白丝网站精品污在线入口|