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

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

?? 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
//

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91网页版在线| 欧美成人一区二区三区片免费 | 日韩视频在线观看一区二区| 精品久久久久一区| 亚洲欧美色一区| 国产乱人伦偷精品视频不卡| 欧美午夜精品一区二区三区| 久久精品水蜜桃av综合天堂| 天天综合天天综合色| 99re视频精品| 国产婷婷一区二区| 麻豆精品在线观看| 欧美日韩在线综合| 中文字幕一区二区5566日韩| 激情五月激情综合网| 欧美视频三区在线播放| 国产精品丝袜一区| 精品一区二区免费看| 欧美喷潮久久久xxxxx| 综合久久久久久| 国产精品 欧美精品| 欧美精品一区二区三区在线 | 久久精品免视看| 日本三级亚洲精品| 欧美视频在线一区二区三区| 中文字幕视频一区| 国产91富婆露脸刺激对白| 日韩美一区二区三区| 婷婷夜色潮精品综合在线| 色88888久久久久久影院野外| 中日韩免费视频中文字幕| 激情久久五月天| 亚洲精品在线一区二区| 蜜桃精品视频在线| 日韩欧美美女一区二区三区| 日韩和欧美一区二区三区| 欧美午夜理伦三级在线观看| 亚洲成在人线在线播放| 欧美伊人久久久久久久久影院 | 成人精品亚洲人成在线| 精品久久久久99| 久久99国产精品久久99果冻传媒| 欧美一二三四区在线| 日韩成人av影视| 日韩精品资源二区在线| 久久精品国产秦先生| 精品日韩在线观看| 激情成人综合网| 国产婷婷色一区二区三区四区 | 美女爽到高潮91| 日韩欧美国产综合一区| 国产乱码精品1区2区3区| 欧美韩国日本一区| 91啪亚洲精品| 亚洲v精品v日韩v欧美v专区| 欧美va在线播放| 成人动漫一区二区| 亚洲激情成人在线| 欧美精品自拍偷拍| 韩国精品主播一区二区在线观看| 中文字幕av一区二区三区高| 日本道免费精品一区二区三区| 亚洲高清在线精品| 精品久久久久久久久久久久久久久 | 欧美日韩午夜在线| 精品在线观看免费| 亚洲欧美在线另类| 欧美一区二区高清| 成a人片国产精品| 亚洲综合激情小说| 日韩精品一区二区三区蜜臀| av中文字幕亚洲| 偷拍与自拍一区| 国产日韩亚洲欧美综合| 在线观看日韩精品| 国产精品资源在线看| 一区二区三区精品在线| 精品国产一区a| 色综合网站在线| 欧美aaa在线| 亚洲视频一区在线| www国产精品av| 欧美精品视频www在线观看| 国产电影精品久久禁18| 亚洲成人动漫在线观看| 日本一区二区三区在线不卡| 欧美一区二区视频网站| 东方aⅴ免费观看久久av| 水蜜桃久久夜色精品一区的特点| 国产精品女同一区二区三区| 欧美一区二区三区四区视频| 色成人在线视频| 成人一区在线观看| 精品一区二区综合| 亚洲大片精品永久免费| 亚洲视频 欧洲视频| 国产视频一区二区三区在线观看| 欧美日韩精品一区二区天天拍小说| 成人av影院在线| 国产做a爰片久久毛片| 青娱乐精品视频在线| 亚洲国产精品久久久久婷婷884 | 一区二区三区视频在线看| 久久久久久久综合| 精品少妇一区二区三区在线视频| 欧美久久一区二区| 色悠久久久久综合欧美99| 成人a区在线观看| 国产美女av一区二区三区| 日韩精品电影在线| 午夜欧美大尺度福利影院在线看| 亚洲精品中文在线| 综合在线观看色| 亚洲欧美影音先锋| 亚洲精品视频在线| 中文字幕综合网| 亚洲婷婷在线视频| 最新成人av在线| 亚洲精品日韩一| 亚洲精品免费在线| 一区二区三区日韩欧美| 亚洲激情av在线| 亚洲韩国精品一区| 午夜精品一区二区三区电影天堂 | 激情国产一区二区| 国产老妇另类xxxxx| 激情av综合网| 成人网男人的天堂| 99精品一区二区| 日本电影欧美片| 51久久夜色精品国产麻豆| 51精品久久久久久久蜜臀| 欧美电影免费观看完整版| 国产亚洲欧美一级| 国产精品色哟哟网站| 一区二区三区资源| 日韩av电影一区| 狠狠色丁香久久婷婷综合_中| 国产精品一区免费视频| 成人晚上爱看视频| 欧美综合视频在线观看| 91精品国产麻豆国产自产在线| 欧美成人免费网站| 国产精品视频线看| 亚洲国产一区二区三区青草影视| 日本在线不卡一区| 国产91精品久久久久久久网曝门| 91年精品国产| 欧美一区在线视频| 欧美经典一区二区| 亚洲成人在线观看视频| 激情综合色播五月| 91免费在线播放| 日韩欧美一区二区不卡| 国产精品三级视频| 亚洲第一福利视频在线| 国产一区二区日韩精品| 欧洲一区在线电影| 欧美成va人片在线观看| 1000精品久久久久久久久| 青青草伊人久久| 色综合久久久久综合体| 日韩欧美精品在线视频| 亚洲欧美日韩系列| 狠狠色伊人亚洲综合成人| 欧美亚洲尤物久久| 久久久久亚洲综合| 午夜久久久久久电影| 成人黄色在线网站| 日韩天堂在线观看| 亚洲影院在线观看| 国产jizzjizz一区二区| 欧美顶级少妇做爰| 亚洲欧美日韩系列| 丰满白嫩尤物一区二区| 欧美一级理论性理论a| 亚洲男人天堂av网| 成人h精品动漫一区二区三区| 欧美白人最猛性xxxxx69交| 亚洲亚洲精品在线观看| www.欧美色图| 久久久www成人免费无遮挡大片| 天天av天天翘天天综合网色鬼国产| 99精品在线免费| 国产精品久久久久影视| 久久99国产精品久久| 欧美一区二区三区爱爱| 樱桃视频在线观看一区| 粉嫩嫩av羞羞动漫久久久| 日韩精品一区二区三区在线观看| 亚洲成av人在线观看| 色天使色偷偷av一区二区| 国产精品美女久久福利网站 | 精品三级在线看| 日韩电影免费一区| 欧美精品丝袜中出| 午夜精品福利一区二区三区av | 26uuu色噜噜精品一区| 日韩影视精彩在线| 欧美日韩国产免费|