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

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

?? fade.c

?? C:Documents and SettingsAdministrator桌面VC++多媒體特效制作百例CHAR05PALFADE
?? C
?? 第 1 頁 / 共 2 頁
字號:
//****************************************************************************
// File: fade.c
//
// Purpose:    Shows how to perform palette animation on a logical palette to 
//             fade a bitmap to black.  Also shows how to reduce a 256 color 
//             palette to a 236 color palette.
//
// Development Team:
//         Greg Binkerd - Windows Developer Support
//
// Written by Microsoft Windows Developer Support
// Copyright (c) 1995 Microsoft Corporation. All rights reserved.
//****************************************************************************

#include <stdio.h>
#include <windows.h>     // required for all Windows applications
#include "fade.h"    // specific to this program
#include "dibapi.h"    // specific to this program

extern HINSTANCE hInst;      // current instance 
extern char szAppName[];  // The name of this application


//***********************************************************************
// Function: FadeBitmap
//
// Purpose: Called when the user requests to load and fade a bitmap.
//
// Parameters:
//    hWnd      == Handle to the main window
//
// Returns: BOOL indicating success or failure
//
// Comments:
//
// History:  Date       Author        Reason
//           5/24/95    GGB           Created
//****************************************************************************

BOOL FadeBitmap(HWND hWnd)
            {         
            HDC hdc;
            HPALETTE hPalette;
            HDIB hDib;
            LPSTR lpDib;
            RECT rc;
			int nPalNumColors;
            static PALETTEENTRY pe[256];
            int i,j;
            static char szFile[256];
            
            if (!(GetFileName (szFile)))
              return 0;
            hdc = GetDC(hWnd);
            if (!(hDib = OpenDIB(szFile)))
			  {
              ReleaseDC(hWnd,hdc);   
			  MessageBox(hWnd,"Invalid Bitmap File",szAppName,MB_OK);
			  return 0;
			  }
		    // Create a 236 colors or less logical palette with PC_RESERVED set
            if (!(hPalette = CreateDIBPaletteReserved(hDib,&nPalNumColors)))
			  {
              ReleaseDC(hWnd,hdc);   
              DestroyDIB(hDib);
			  MessageBox(hWnd,"8 BPP DIB's or less are only supported",szAppName,MB_OK);
			  return 0;
			  }
            // Select and realize the palette
            SelectPalette(hdc,hPalette,FALSE);
            RealizePalette(hdc);
            lpDib = GlobalLock(hDib);
            SetRect(&rc,0,0,(int)DIBHeight((LPSTR)lpDib),(int)DIBWidth((LPSTR)lpDib));
            GlobalUnlock(hDib);
            // Display the DIB
            PaintDIB (hdc, &rc, hDib, &rc, hPalette);  

            // Obtain the original entries in the palette and place them in "pe"
            GetPaletteEntries(hPalette, 0, nPalNumColors, (LPPALETTEENTRY)&pe);

            //Decrement all of the RGB color values in the palette until they are all (0,0,0)
            for (i=0; i<256; i++) 
              {
              for (j = 0; j<nPalNumColors; j++) 
                {  
                if (pe[j].peRed)   pe[j].peRed--;
                if (pe[j].peGreen) pe[j].peGreen--;
                if (pe[j].peBlue)  pe[j].peBlue--;
                }
              AnimatePalette(hPalette, 0, nPalNumColors, (LPPALETTEENTRY)&pe);
			  // Delay...
			  Sleep(3);
              }
            
			//  Clean up
            DeleteObject(hPalette);
            DestroyDIB(hDib);
            ReleaseDC(hWnd,hdc);   
            InvalidateRect(hWnd,NULL,TRUE);
            }


//***********************************************************************
// Function: CreateDIBPaletteReserved
//
// Purpose: Creates a logical palette for a given DIB.  Will ensure that
//          the palette is 236 colors or less.
//
// Parameters:
//    hDIB      == Handle to the DIB
//    nPalNumColors  == Used to return the number of colors in the palette
//
// Returns: Logical palette for the DIB
//
// Comments:  Parts of the code taken from the wincap32 SDK sample
//
// History:  Date       Author        Reason
//           5/24/95    GGB           Created
//****************************************************************************

HPALETTE FAR CreateDIBPaletteReserved (HDIB hDIB, int *nPalNumColors)
{
   LPLOGPALETTE lpPal;      // pointer to a logical palette
   HANDLE hLogPal;          // handle to a logical palette
   HPALETTE hPal = NULL;    // handle to a palette
   int i, nNumColors;       // loop index, number of colors in "revised" color table
   LPSTR lpbi;              // pointer to packed-DIB
   LPBITMAPINFO lpbmi;      // pointer to BITMAPINFO structure (Win3.0)
   LPBITMAPCOREINFO lpbmc;  // pointer to BITMAPCOREINFO structure (OS/2)
   BOOL bWinStyleDIB;       // flag which signifies whether this is a Win3.0 DIB

   /* if handle to DIB is invalid, return NULL */

   if (!hDIB)
      return NULL;

   /* lock DIB memory block and get a pointer to it */
   lpbi = GlobalLock(hDIB);
   /* 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 */
   nNumColors = DIBNumColors(lpbi);
   /* is this a Win 3.0 DIB? */
   bWinStyleDIB = IS_WIN30_DIB(lpbi);
   // If it is a 256 color DIB, then let's find the lost used 236 colors and make a
   // palette out of those colors
   if (nNumColors == 256)
      {
      typedef struct _tagBESTCOLORS
          {
          DWORD dwColorCnt;   //Count of how many times a color is used
          BOOL  bDontUse;     //Should we use this color?
          } BESTCOLORS;
      
      static BESTCOLORS bc[256];
      BYTE dwLeastUsed[20];    // Least used color indices
      LPSTR lpBits;            // pointer to D.I. bits of a DIB
      int   nWidth, nHeight, nBytesPerLine, cx, cy;   
      
      memset(bc,0,256*sizeof(BESTCOLORS));
      // We should only have 236 colors in our logical palette
      nNumColors = 236;
      lpBits = FindDIBBits(lpbi);  
      nWidth = DIBWidth(lpbi);
      nHeight = DIBHeight(lpbi);
      nBytesPerLine = WIDTHBYTES(nWidth*8);
      // Traverse through all of the bits in the bitmap and place the color count
	  // of each color in the BESTCOLORS array
      for (cy = 0; cy < nHeight; cy++)
         for (cx = 0; cx < nWidth; cx++)
            bc[*(LPBYTE)(lpBits+cy*nBytesPerLine+cx)].dwColorCnt++;
           
      // Let's arbitrarily place the first 20 colors in the "Least Used" list.
      for (cx=0;cx<20;cx++)
         {
         bc[cx].bDontUse = TRUE;
         dwLeastUsed[cx] = cx;
         }

      // Now, let's traverse through all of the colors and sort out the 20 least used
      for (cx=0;cx<256;cx++)
           {
           cy = 0;
           while ((!(bc[cx].bDontUse)) && cy <20)
              {
              if (bc[cx].dwColorCnt < bc[dwLeastUsed[cy]].dwColorCnt) 
                 {     
                 bc[dwLeastUsed[cy]].bDontUse = FALSE;
                 dwLeastUsed[cy] = cx;
                 bc[cx].bDontUse = TRUE;
                 }
              cy++;
              }
           }

      /* allocate memory block for logical palette */
      hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) *
                nNumColors);

      /* if not enough memory, clean up and return NULL */
      if (!hLogPal)
      {
     GlobalUnlock(hDIB);
     return NULL;
      }

      /* lock memory block and get pointer to it */
      lpPal = (LPLOGPALETTE)GlobalLock(hLogPal);

      /* set version and number of palette entries */
      lpPal->palVersion = 0x300;
      lpPal->palNumEntries = nNumColors;

      /*  store RGB triples (if Win 3.0 DIB) or RGB quads (if OS/2 DIB)
       *  into palette
       */
	  cx = 0;
      for (i = 0; i < 256; i++)
        {
		// Should we use this color?
     	if (!((bc[i].bDontUse)))
		    {  
            if (bWinStyleDIB)
               {
               lpPal->palPalEntry[cx].peRed = lpbmi->bmiColors[i].rgbRed;
	           lpPal->palPalEntry[cx].peGreen = lpbmi->bmiColors[i].rgbGreen;
	           lpPal->palPalEntry[cx].peBlue = lpbmi->bmiColors[i].rgbBlue;
   	           lpPal->palPalEntry[cx].peFlags = PC_RESERVED;
               }
            else
               {
               lpPal->palPalEntry[cx].peRed = lpbmc->bmciColors[i].rgbtRed;
               lpPal->palPalEntry[cx].peGreen = lpbmc->bmciColors[i].rgbtGreen;
               lpPal->palPalEntry[cx].peBlue = lpbmc->bmciColors[i].rgbtBlue;
               lpPal->palPalEntry[cx].peFlags = PC_RESERVED;
               }
  	        cx++;
			}
        }

      /* 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;
	      }
      GlobalUnlock(hLogPal);
      GlobalFree(hLogPal);
      }

   // Else, let's do it the normal way (from wincap32) but make sure that we are 236 color
   // or less.
   else if (nNumColors)
   {
      if (nNumColors > 236)
	     nNumColors = 236;

      /* allocate memory block for logical palette */
      hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) *
                nNumColors);

      /* if not enough memory, clean up and return NULL */
      if (!hLogPal)
	      {
 	      GlobalUnlock(hDIB);
	      return NULL;
	      }

      /* lock memory block and get pointer to it */
      lpPal = (LPLOGPALETTE)GlobalLock(hLogPal);

      /* set version and number of palette entries */
      lpPal->palVersion = 0x300;
      lpPal->palNumEntries = nNumColors;

      /*  store RGB triples (if Win 3.0 DIB) or RGB quads (if OS/2 DIB)
       *  into palette
       */
      for (i = 0; i < nNumColors; 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 = PC_RESERVED;
	        }
	      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 = PC_RESERVED;
	        }
	      }

      /* 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;
      }
   GlobalUnlock(hLogPal);
   GlobalFree(hLogPal);
   }

   /* clean up */
   GlobalUnlock(hDIB);

   /* return handle to DIB's palette */
   *nPalNumColors = nNumColors;
   return hPal;
}
 
 
//***********************************************************************
// Function: GetFileName
//
// Purpose: Calls the GetOpenFileName common dialog to allow the user to
//          select a bitmap to display
//
// Parameters:
//    szFileName  == File name of .BMP to siaply
//
// Returns: BOOL indicating success or failure
//
// Comments:  Parts of the code taken from the DibView 16 bit SDK sample
//

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品传媒入口麻豆| 久久久久久日产精品| 国产午夜精品久久久久久免费视| 亚洲综合在线电影| 国产91综合一区在线观看| 91精品国产麻豆| 亚洲区小说区图片区qvod| 极品少妇一区二区| 欧美一区二区视频观看视频| 亚洲三级小视频| 国产高清在线精品| 欧美一区二区三区公司| 亚洲自拍偷拍图区| av在线一区二区| 国产婷婷精品av在线| 美女在线观看视频一区二区| 色老综合老女人久久久| 亚洲国产成人午夜在线一区| 久久国产日韩欧美精品| 国产精品视频免费| 欧美日韩精品福利| 亚洲日韩欧美一区二区在线| 国产+成+人+亚洲欧洲自线| 日韩久久精品一区| 日韩一区精品字幕| 欧美视频自拍偷拍| 亚洲欧美一区二区三区国产精品 | 久久精品夜色噜噜亚洲a∨| 日本中文字幕一区二区有限公司| 在线观看视频一区二区| 日韩美女视频一区二区| eeuss国产一区二区三区| 国产日韩成人精品| 国产999精品久久| 欧美国产一区二区在线观看 | 亚洲自拍与偷拍| 色综合中文综合网| 欧美精品在线观看一区二区| 亚洲宅男天堂在线观看无病毒| 色视频一区二区| 亚洲色图制服诱惑| 99久久综合国产精品| 中文文精品字幕一区二区| 丁香另类激情小说| 1000精品久久久久久久久| 99久久综合狠狠综合久久| 亚洲男人都懂的| 欧美在线视频你懂得| 亚洲va欧美va人人爽| 69堂国产成人免费视频| 日本亚洲天堂网| 欧美tickling挠脚心丨vk| 国产精品小仙女| 欧美国产日产图区| 色综合中文综合网| 欧美日韩国产另类一区| 亚洲综合成人网| 欧美老肥妇做.爰bbww视频| 琪琪一区二区三区| 久久综合色天天久久综合图片| 粉嫩在线一区二区三区视频| 亚洲天堂福利av| 欧美亚洲综合久久| 日本大胆欧美人术艺术动态| 精品捆绑美女sm三区| 成人午夜短视频| 亚洲综合精品自拍| 欧美亚洲动漫精品| 中文字幕精品一区二区精品绿巨人 | 国产一区999| 国产精品天干天干在观线| 91蜜桃网址入口| 亚洲成av人片在线| 精品精品国产高清一毛片一天堂| 国产高清不卡二三区| 亚洲视频在线一区| 91精品国产一区二区三区| 国产一区二区三区在线看麻豆| 国产精品美女视频| 欧美日韩视频第一区| 国产乱码精品一区二区三| 亚洲三级免费观看| 日韩欧美国产成人一区二区| 成人精品gif动图一区| 亚洲bt欧美bt精品777| 久久综合九色综合欧美亚洲| 色狠狠色狠狠综合| 麻豆国产精品777777在线| 中文字幕日韩欧美一区二区三区| 欧美美女黄视频| 国产成人免费在线观看不卡| 亚洲国产精品一区二区www| 精品国产一区二区三区忘忧草| 99re这里只有精品首页| 日韩高清一区在线| 中文字幕在线视频一区| 91精品国产日韩91久久久久久| 成熟亚洲日本毛茸茸凸凹| 爽爽淫人综合网网站| 国产精品女主播av| 91精品国产综合久久蜜臀| 国产999精品久久| 日本午夜精品视频在线观看| 亚洲日韩欧美一区二区在线| 精品国产百合女同互慰| 欧美性极品少妇| 高清不卡一区二区| 日本欧美在线看| 亚洲欧美偷拍卡通变态| 久久久久久久久久久黄色| 精品视频全国免费看| 成人免费黄色大片| 黑人巨大精品欧美一区| 亚洲一区欧美一区| 国产精品电影一区二区三区| 欧美精品一区二区在线播放| 在线观看一区二区精品视频| 成人免费视频视频| 久久成人免费网站| 天天影视网天天综合色在线播放| 国产精品传媒视频| 91浏览器打开| 国产精品99久久久久久久女警| 丝袜亚洲另类丝袜在线| 亚洲美女在线国产| 国产精品久久久久久久岛一牛影视 | 国产成a人亚洲| 久久99精品国产.久久久久久| 亚洲在线视频免费观看| 国产精品久久看| 国产日产欧美一区| 精品国产一区二区在线观看| 91精品国产综合久久久久| 欧美综合一区二区| 91成人在线观看喷潮| 成人av免费在线观看| 风流少妇一区二区| 高清免费成人av| 国产麻豆一精品一av一免费| 精品一区二区三区在线播放| 日韩精品一级中文字幕精品视频免费观看 | 亚洲精品国产一区二区精华液 | 国产精品美日韩| 久久久久久免费网| 久久影院午夜片一区| 日韩精品一区二区在线| 欧美一级日韩免费不卡| 777久久久精品| 欧美理论片在线| 5月丁香婷婷综合| 在线播放91灌醉迷j高跟美女 | 日韩精品中文字幕在线不卡尤物| 6080yy午夜一二三区久久| 欧美日韩精品一区视频| 欧美日韩五月天| 欧美日本精品一区二区三区| 欧美视频一区在线| 欧美撒尿777hd撒尿| 欧美日韩高清在线播放| 欧美男男青年gay1069videost| 在线观看91精品国产入口| 欧美视频一区二区三区四区| 欧美视频一二三区| 91精品国产欧美一区二区18 | 欧美一卡二卡在线观看| 欧美一区二区日韩| 精品日韩av一区二区| 久久久久久久久久电影| 日本一区二区成人| 亚洲欧美日韩一区二区三区在线观看| 中文字幕日韩一区二区| 亚洲综合久久久| 日韩不卡一二三区| 韩国av一区二区| 国产91精品免费| 色88888久久久久久影院野外| 欧美无乱码久久久免费午夜一区| 69av一区二区三区| 精品国产乱码久久久久久久| 欧美国产丝袜视频| 一区二区三区成人在线视频| 亚洲h动漫在线| 国产一区二区免费视频| av午夜精品一区二区三区| 色狠狠桃花综合| 91精品国产一区二区| 欧美成人猛片aaaaaaa| 国产精品婷婷午夜在线观看| 亚洲精品你懂的| 亚洲成av人片一区二区三区| 亚洲人午夜精品天堂一二香蕉| 一区二区三区四区视频精品免费 | 日韩制服丝袜av| 国产在线观看一区二区| 91在线视频免费观看| 欧美人与性动xxxx| 国产亚洲午夜高清国产拍精品| 亚洲天堂av老司机| 免费成人av在线播放| 成人性生交大片免费看视频在线|