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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dibhelp.c

?? widows編程例題程序13-18章
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):

     switch (DibBitCount (hdib))
     {
     case  1:  * pPixel &= ~(1     << (7 - (x & 7))) ;
               * pPixel |= dwPixel << (7 - (x & 7)) ;
               break ;

     case  4:  * pPixel &= 0x0F    << (x & 1 ? 4 : 0) ;
               * pPixel |= dwPixel << (x & 1 ? 0 : 4) ;
               break ;

     case  8:  * pPixel = (BYTE) dwPixel ;
               break ;

     case 16:  * (WORD *) pPixel = (WORD) dwPixel ;
               break ;

     case 24:  * (RGBTRIPLE *) pPixel = * (RGBTRIPLE *) &dwPixel ; 
               break ;

     case 32:  * (DWORD *) pPixel = dwPixel ;
               break ;
     default:
          return FALSE ;
     }
     return TRUE ;
}

/*------------------------------------------------------
   DibGetPixelColor:  Obtains the pixel color at (x, y)
  ------------------------------------------------------*/

BOOL DibGetPixelColor (HDIB hdib, int x, int y, RGBQUAD * prgb)
{
     DWORD      dwPixel ;
     int        iBitCount ;
     PDIBSTRUCT pdib = hdib ;

          // Get bit count; also use this as a validity check

     if (0 == (iBitCount = DibBitCount (hdib)))
          return FALSE ;

          // Get the pixel value

     dwPixel = DibGetPixel (hdib, x, y) ;

          // If the bit-count is 8 or less, index the color table

     if (iBitCount <= 8)
          return DibGetColor (hdib, (int) dwPixel, prgb) ;

          // If the bit-count is 24, just use the pixel

     else if (iBitCount == 24)
     {
          * (RGBTRIPLE *) prgb = * (RGBTRIPLE *) & dwPixel ;
          prgb->rgbReserved = 0 ;
     }

          // If the bit-count is 32 and the biCompression field is BI_RGB,
          //   just use the pixel

     else if (iBitCount == 32 && 
               pdib->ds.dsBmih.biCompression == BI_RGB)
     {
          * prgb = * (RGBQUAD *) & dwPixel ;
     }

          // Otherwise, use the mask and shift values
          //   (for best performance, don't use DibMask and DibShift functions)
     else
     {
          prgb->rgbRed   = (BYTE) (((pdib->ds.dsBitfields[0] & dwPixel) 
                                   >> pdib->iRShift[0]) << pdib->iLShift[0]) ;

          prgb->rgbGreen = (BYTE) (((pdib->ds.dsBitfields[1] & dwPixel) 
                                   >> pdib->iRShift[1]) << pdib->iLShift[1]) ;

          prgb->rgbBlue  = (BYTE) (((pdib->ds.dsBitfields[2] & dwPixel) 
                                   >> pdib->iRShift[2]) << pdib->iLShift[2]) ;
     }
     return TRUE ;
}

/*---------------------------------------------------
   DibSetPixelColor:  Sets the pixel color at (x, y) 
  ---------------------------------------------------*/

BOOL DibSetPixelColor (HDIB hdib, int x, int y, RGBQUAD * prgb)
{
     DWORD      dwPixel ;
     int        iBitCount ;
     PDIBSTRUCT pdib = hdib ;

          // Don't do this function for DIBs with color tables

     iBitCount = DibBitCount (hdib) ;

     if (iBitCount <= 8)
          return FALSE ;

          // The rest is just the opposite of DibGetPixelColor

     else if (iBitCount == 24)
     {
          * (RGBTRIPLE *) & dwPixel = * (RGBTRIPLE *) prgb ;
          dwPixel &= 0x00FFFFFF ;
     }

     else if (iBitCount == 32 &&
               pdib->ds.dsBmih.biCompression == BI_RGB)
     {
          * (RGBQUAD *) & dwPixel = * prgb ;
     }

     else
     {
          dwPixel  = (((DWORD) prgb->rgbRed >> pdib->iLShift[0]) 
                         << pdib->iRShift[0]) ; 

          dwPixel |= (((DWORD) prgb->rgbGreen >> pdib->iLShift[1])
                         << pdib->iRShift[1]) ; 

          dwPixel |= (((DWORD) prgb->rgbBlue >> pdib->iLShift[2])
                         << pdib->iRShift[2]) ; 
     }

     DibSetPixel (hdib, x, y, dwPixel) ;
     return TRUE ;
}

/*--------------------------------------------------------------
   Calculating shift values from color masks is required by the 
     DibCreateFromInfo function.
  --------------------------------------------------------------*/

static int MaskToRShift (DWORD dwMask)
{
     int iShift ;

     if (dwMask == 0)
          return 0 ;

     for (iShift = 0 ; !(dwMask & 1) ; iShift++)
          dwMask >>= 1 ;

     return iShift ;
}

static int MaskToLShift (DWORD dwMask)
{
     int iShift ;

     if (dwMask == 0)
          return 0 ;

     while (!(dwMask & 1))
          dwMask >>= 1 ;

     for (iShift = 0 ; dwMask & 1 ; iShift++)
          dwMask >>= 1 ;

     return 8 - iShift ;
}

/*-------------------------------------------------------------------------
   DibCreateFromInfo: All DIB creation functions ultimately call this one.
     This function is responsible for calling CreateDIBSection, allocating
     memory for DIBSTRUCT, and setting up the row pointer.
  -------------------------------------------------------------------------*/

HDIB DibCreateFromInfo (BITMAPINFO * pbmi)
{
     BYTE      * pBits ;
     DIBSTRUCT * pdib ;
     HBITMAP     hBitmap ;
     int         i, iRowLength, cy, y ;
     
     hBitmap = CreateDIBSection (NULL, pbmi, DIB_RGB_COLORS, &pBits, NULL, 0) ;

     if (hBitmap == NULL)
          return NULL ;

     if (NULL == (pdib = malloc (sizeof (DIBSTRUCT))))
     {
          DeleteObject (hBitmap) ;
          return NULL ;
     }

     pdib->iSignature = HDIB_SIGNATURE ;
     pdib->hBitmap    = hBitmap ;
     pdib->pBits      = pBits ;

     GetObject (hBitmap, sizeof (DIBSECTION), &pdib->ds) ;

          // Notice that we can now use the DIB information functions 
          //   defined above.

          // If the compression is BI_BITFIELDS, calculate shifts from masks

     if (DibCompression (pdib) == BI_BITFIELDS)
     {
          for (i = 0 ; i < 3 ; i++)
          {
               pdib->iLShift[i] = MaskToLShift (pdib->ds.dsBitfields[i]) ;
               pdib->iRShift[i] = MaskToRShift (pdib->ds.dsBitfields[i]) ;
          }
     }

          // If the compression is BI_RGB, but bit-count is 16 or 32,
          //   set the bitfields and the masks

     else if (DibCompression (pdib) == BI_RGB)
     {
          if (DibBitCount (pdib) == 16)
          {
               pdib->ds.dsBitfields[0] = 0x00007C00 ;
               pdib->ds.dsBitfields[1] = 0x000003E0 ;
               pdib->ds.dsBitfields[2] = 0x0000001F ;

               pdib->iRShift[0] = 10 ;
               pdib->iRShift[1] =  5 ;
               pdib->iRShift[2] =  0 ; 

               pdib->iLShift[0] =  3 ;
               pdib->iLShift[1] =  3 ;
               pdib->iLShift[2] =  3 ;
          }
          else if (DibBitCount (pdib) == 24 || DibBitCount (pdib) == 32)
          {
               pdib->ds.dsBitfields[0] = 0x00FF0000 ;
               pdib->ds.dsBitfields[1] = 0x0000FF00 ;
               pdib->ds.dsBitfields[2] = 0x000000FF ;

               pdib->iRShift[0] = 16 ;
               pdib->iRShift[1] =  8 ;
               pdib->iRShift[2] =  0 ; 

               pdib->iLShift[0] =  0 ;
               pdib->iLShift[1] =  0 ;
               pdib->iLShift[2] =  0 ;
          }
     }
          // Allocate an array of pointers to each row in the DIB

     cy = DibHeight (pdib) ;

     if (NULL == (pdib->ppRow = malloc (cy * sizeof (BYTE *))))
     {
          free (pdib) ;
          DeleteObject (hBitmap) ;
          return NULL ;
     }

          // Initialize them.

     iRowLength = DibRowLength (pdib) ; 

     if (pbmi->bmiHeader.biHeight > 0)       // ie, bottom up
     {
          for (y = 0 ; y < cy ; y++)
               pdib->ppRow[y] = pBits + (cy - y - 1) * iRowLength ;
     }
     else                                    // top down
     {
          for (y = 0 ; y < cy ; y++)
               pdib->ppRow[y] = pBits + y * iRowLength ;
     }
     return pdib ;
}

/*--------------------------------------------------
   DibDelete:  Frees all memory for the DIB section
  --------------------------------------------------*/

BOOL DibDelete (HDIB hdib)
{
     DIBSTRUCT * pdib = hdib ;

     if (!DibIsValid (hdib))
          return FALSE ;

     free (pdib->ppRow) ;
     DeleteObject (pdib->hBitmap) ;
     free (pdib) ;
     return TRUE ;
}

/*----------------------------------------------------
   DibCreate: Creates an HDIB from explicit arguments
  ----------------------------------------------------*/ 

HDIB DibCreate (int cx, int cy, int cBits, int cColors)
{
     BITMAPINFO * pbmi ;
     DWORD        dwInfoSize ;
     HDIB         hDib ;
     int          cEntries ;

     if (cx <= 0 || cy <= 0 || 
         ((cBits !=  1) && (cBits !=  4) && (cBits !=  8) && 
          (cBits != 16) && (cBits != 24) && (cBits != 32)))
     {
          return NULL ;
     }

     if (cColors != 0)
          cEntries = cColors ;
     else if (cBits <= 8)
          cEntries = 1 << cBits ;

     dwInfoSize = sizeof (BITMAPINFOHEADER) + (cEntries - 1) * sizeof (RGBQUAD);

     if (NULL == (pbmi = malloc (dwInfoSize)))
     {
          return NULL ;
     }

     ZeroMemory (pbmi, dwInfoSize) ;

     pbmi->bmiHeader.biSize          = sizeof (BITMAPINFOHEADER) ;
     pbmi->bmiHeader.biWidth         = cx ;
     pbmi->bmiHeader.biHeight        = cy ;
     pbmi->bmiHeader.biPlanes        = 1 ;
     pbmi->bmiHeader.biBitCount      = cBits ;
     pbmi->bmiHeader.biCompression   = BI_RGB ;
     pbmi->bmiHeader.biSizeImage     = 0 ;
     pbmi->bmiHeader.biXPelsPerMeter = 0 ;
     pbmi->bmiHeader.biYPelsPerMeter = 0 ;
     pbmi->bmiHeader.biClrUsed       = cColors ;
     pbmi->bmiHeader.biClrImportant  = 0 ;

     hDib = DibCreateFromInfo (pbmi) ;
     free (pbmi) ;

     return hDib ;
}

/*--------------------------------------------------
   DibCopyToInfo:  Builds BITMAPINFO structure.
                   Used by DibCopy and DibCopyToDdb
  --------------------------------------------------*/

static BITMAPINFO * DibCopyToInfo (HDIB hdib)
{
     BITMAPINFO * pbmi ;
     int          i, iNumColors ;
     RGBQUAD    * prgb ;

     if (!DibIsValid (hdib))
          return NULL ;

          // Allocate the memory

     if (NULL == (pbmi = malloc (DibInfoSize (hdib))))
          return NULL ;

          // Copy the information header

     CopyMemory (pbmi, DibInfoHeaderPtr (hdib), 
                                        sizeof (BITMAPINFOHEADER));
          
          // Copy the possible color masks

     prgb = (RGBQUAD *) ((BYTE *) pbmi + sizeof (BITMAPINFOHEADER)) ;

     if (DibMaskSize (hdib))
     {
          CopyMemory (prgb, DibMaskPtr (hdib), 3 * sizeof (DWORD)) ;

          prgb = (RGBQUAD *) ((BYTE *) prgb + 3 * sizeof (DWORD)) ;
     }
          // Copy the color table

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久国产精品麻豆| 久久免费国产精品| 国产盗摄视频一区二区三区| 洋洋av久久久久久久一区| 日韩三级在线观看| 色菇凉天天综合网| 成人美女视频在线观看| 久久精品国产精品亚洲红杏| 日韩理论片中文av| 国产三级一区二区| 精品免费国产一区二区三区四区| 色欧美片视频在线观看| 国产mv日韩mv欧美| 卡一卡二国产精品| 亚洲成a人v欧美综合天堂下载| 国产精品九色蝌蚪自拍| 久久综合九色综合97_久久久| 欧美日韩在线免费视频| 色哟哟一区二区三区| 高清不卡在线观看| 国产一本一道久久香蕉| 久久国产精品第一页| 视频一区二区欧美| 五月天欧美精品| 一区二区三区在线免费观看| 中文字幕亚洲在| 中文字幕一区在线观看视频| 国产精品少妇自拍| 欧洲国内综合视频| 国内精品伊人久久久久av影院| 日本中文字幕一区二区有限公司| 亚洲综合免费观看高清在线观看| 中文字幕欧美日本乱码一线二线| 亚洲精品一区二区三区99| 精品国产精品网麻豆系列| 日韩欧美中文字幕制服| 日韩一区二区免费在线观看| 欧美一区二区精品| 日韩欧美一卡二卡| 久久综合色之久久综合| 欧美精品一区二区在线观看| 精品粉嫩aⅴ一区二区三区四区| 欧美电影免费观看高清完整版在 | 欧美va亚洲va| 欧美电影免费观看高清完整版| 日韩无一区二区| 亚洲精品一区二区三区四区高清 | 国产精品免费视频一区| 国产精品不卡在线| 亚洲精品国产视频| 亚洲第一主播视频| 奇米色一区二区三区四区| 激情综合色播五月| 国内精品在线播放| va亚洲va日韩不卡在线观看| 99久久精品免费看国产免费软件| 91国偷自产一区二区三区成为亚洲经典| 在线看日韩精品电影| 欧美另类变人与禽xxxxx| 日韩一区二区在线免费观看| 欧美精品一区二区不卡 | 亚洲图片欧美激情| 久久99久久99| 国产乱人伦偷精品视频不卡| 波多野结衣中文字幕一区二区三区| 91啦中文在线观看| 欧美欧美午夜aⅴ在线观看| 亚洲精品在线观| 国产精品欧美一级免费| 亚洲日本青草视频在线怡红院 | 精品精品欲导航| 久久综合九色综合欧美亚洲| 亚洲国产高清不卡| 亚洲日本乱码在线观看| 蜜桃视频一区二区三区在线观看| 国产福利一区二区三区在线视频| 成人黄色大片在线观看| 欧美乱熟臀69xxxxxx| 国产亚洲欧美一级| 午夜视黄欧洲亚洲| 丁香婷婷综合激情五月色| 97se亚洲国产综合自在线观| 91麻豆精品国产91久久久久| 国产欧美一区二区精品性色超碰| 亚洲一区二区高清| 免费成人结看片| 丁香六月综合激情| 欧美天堂一区二区三区| 中文字幕不卡的av| 视频一区二区中文字幕| 99久久精品免费看国产免费软件| 欧美一区二区三区视频在线观看| 久久这里只精品最新地址| 亚洲美女免费在线| 国产精品正在播放| 欧美日韩在线直播| 中文成人av在线| 美国十次综合导航| 在线观看免费视频综合| 国产农村妇女毛片精品久久麻豆 | 亚洲人成小说网站色在线| 秋霞电影网一区二区| 91美女视频网站| 国产欧美一区二区精品忘忧草 | 国产91丝袜在线播放0| 91精品在线免费| 一区二区三区av电影| 国内精品视频666| 51精品视频一区二区三区| 亚洲精品水蜜桃| 成人一区二区三区视频| 久久人人爽爽爽人久久久| 日韩高清一区在线| 欧美男男青年gay1069videost| 国产精品成人免费在线| 国产精品一线二线三线精华| 国产精品你懂的在线欣赏| 国产在线精品免费| 欧美大度的电影原声| 日产国产高清一区二区三区| 欧美三区在线视频| 亚洲二区在线观看| 91热门视频在线观看| 国产精品不卡在线| 成人丝袜高跟foot| 国产欧美一区二区精品婷婷 | 亚洲欧洲国产日本综合| 国产精品白丝av| 久久你懂得1024| 麻豆精品在线播放| 日韩欧美国产精品一区| 亚洲成a人片在线观看中文| 色综合久久久久网| 亚洲色图在线播放| 色噜噜夜夜夜综合网| 亚洲人妖av一区二区| 99久久精品国产网站| 国产精品对白交换视频| 国产一区中文字幕| 日韩欧美亚洲一区二区| 日韩国产在线观看| 欧美成人综合网站| 蜜桃视频免费观看一区| 精品入口麻豆88视频| 狠狠色综合日日| 国产亚洲va综合人人澡精品| 国产精品456露脸| 国产精品色婷婷| 99在线精品免费| 亚洲久草在线视频| 91在线视频观看| 一区在线观看视频| 日本精品视频一区二区三区| 一区二区三区中文在线观看| 欧美亚洲国产一区二区三区| 日韩在线一区二区| www亚洲一区| 国产成人精品免费在线| 悠悠色在线精品| 欧美一卡二卡三卡四卡| 亚洲一区在线观看视频| 日韩亚洲欧美一区| 国产91丝袜在线播放九色| 一区二区欧美精品| 欧美精品v日韩精品v韩国精品v| 亚洲午夜在线电影| 日韩一区二区免费高清| 成人免费av网站| 亚洲第一电影网| 日韩一区二区中文字幕| 国产风韵犹存在线视精品| 亚洲女人****多毛耸耸8| 91麻豆精品国产自产在线观看一区 | 国产精品色在线观看| 欧美中文字幕亚洲一区二区va在线 | 91极品美女在线| 免费成人在线播放| 综合久久给合久久狠狠狠97色| 欧美浪妇xxxx高跟鞋交| 国产精品99久久久久久似苏梦涵| 一区二区久久久| 欧美成人福利视频| 首页亚洲欧美制服丝腿| 国产午夜精品一区二区三区四区| 97久久超碰精品国产| 免费成人美女在线观看| 亚洲天堂精品视频| 日韩免费高清视频| 在线免费亚洲电影| 成人小视频在线| 洋洋av久久久久久久一区| 欧美xxxx老人做受| 色嗨嗨av一区二区三区| 国产精品一区二区三区99| 亚洲愉拍自拍另类高清精品| 精品国产第一区二区三区观看体验| 色综合欧美在线| 丁香五精品蜜臀久久久久99网站 | av电影在线观看完整版一区二区| 日欧美一区二区|