資源簡介
實現圖像的縮小與放大,程序針對RGB圖像,不對YUV圖像處理
代碼片段和文件信息
//??dibapi.cpp
//
//??Source?file?for?Device-Independent?Bitmap?(DIB)?API.??Provides
//??the?following?functions:
//
//??PaintDIB()??????????-?Painting?routine?for?a?DIB
//??CreateDIBPalette()??-?Creates?a?palette?from?a?DIB
//??FindDIBBits()???????-?Returns?a?pointer?to?the?DIB?bits
//??DIBWidth()??????????-?Gets?the?width?of?the?DIB
//??DIBHeight()?????????-?Gets?the?height?of?the?DIB
//??PaletteSize()???????-?Gets?the?size?required?to?store?the?DIB‘s?palette
//??DIBNumColors()??????-?Calculates?the?number?of?colors
//????????????????????????in?the?DIB‘s?color?table
//??CopyHandle()????????-?Makes?a?copy?of?the?given?global?memory?block
//
//?This?is?a?part?of?the?Microsoft?Foundation?Classes?C++?library.
//?Copyright?(C)?1992-1997?Microsoft?Corporation
//?All?rights?reserved.
//
//?This?source?code?is?only?intended?as?a?supplement?to?the
//?Microsoft?Foundation?Classes?Reference?and?related
//?electronic?documentation?provided?with?the?library.
//?See?these?sources?for?detailed?information?regarding?the
//?Microsoft?Foundation?Classes?product.
#include?“stdafx.h“
#include?“dibapi.h“
#include?
#include?
#include?
#define?DIB_HEADER_MARKER???((WORD)?(‘M‘?<8)?|?‘B‘)
#ifdef?_MAC
#define?SWAPWORD(x)?MAKEWORD(HIBYTE(x)?LOBYTE(x))
#define?SWAPLONG(x)?MAKELONG(SWAPWORD(HIWORD(x))?SWAPWORD(LOWORD(x)))
void?ByteSwapHeader(BITMAPFILEHEADER*?bmiHeader);
void?ByteSwapInfo(LPSTR?lpHeader?BOOL?fWin30Header);
#endif
/*************************************************************************
?*
?*?PaintDIB()
?*
?*?Parameters:
?*
?*?HDC?hDC??????????-?DC?to?do?output?to
?*
?*?LPRECT?lpDCRect??-?rectangle?on?DC?to?do?output?to
?*
?*?HDIB?hDIB????????-?handle?to?global?memory?with?a?DIB?spec
?*????????????????????in?it?followed?by?the?DIB?bits
?*
?*?LPRECT?lpDIBRect?-?rectangle?of?DIB?to?output?into?lpDCRect
?*
?*?CPalette*?pPal???-?pointer?to?CPalette?containing?DIB‘s?palette
?*
?*?Return?Value:
?*
?*?BOOL?????????????-?TRUE?if?DIB?was?drawn?FALSE?otherwise
?*
?*?Description:
?*???Painting?routine?for?a?DIB.??Calls?StretchDIBits()?or
?*???SetDIBitsToDevice()?to?paint?the?DIB.??The?DIB?is
?*???output?to?the?specified?DC?at?the?coordinates?given
?*???in?lpDCRect.??The?area?of?the?DIB?to?be?output?is
?*???given?by?lpDIBRect.
?*
?************************************************************************/
BOOL?WINAPI?PaintDIB(HDC?????hDC
LPRECT??lpDCRect
HDIB????hDIB
LPRECT??lpDIBRect
CPalette*?pPal)
{
LPSTR????lpDIBHdr;????????????//?Pointer?to?BITMAPINFOHEADER
LPSTR????lpDIBBits;???????????//?Pointer?to?DIB?bits
BOOL?????bSuccess=FALSE;??????//?Success/fail?flag
HPALETTE?hPal=NULL;???????????//?Our?DIB‘s?palette
HPALETTE?hOldPal=NULL;????????//?Previous?palette
/*?Check?for?valid?DIB?handle?*/
if?(hDIB?==?NULL)
return?FALSE;
/*?Lock?down?the?DIB?and?get?a?pointer?to?the?beginning?of?the?bit
?*??buffer
?*/
l
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????288??2008-06-25?08:15??13\readme.nfo
?????文件????????521??2008-06-25?07:41??13\softii.com.nfo
?????文件????????171??2008-05-11?09:33??13\人人軟件站.url
?????文件????????288??2008-06-25?08:15??13\嗾俏縮放\readme.nfo
?????文件????????521??2008-06-25?07:41??13\嗾俏縮放\softii.com.nfo
?????文件????????171??2008-05-11?09:33??13\嗾俏縮放\人人軟件站.url
?????文件????????288??2008-06-25?08:15??13\嗾俏縮放\測試圖像\readme.nfo
?????文件????????521??2008-06-25?07:41??13\嗾俏縮放\測試圖像\softii.com.nfo
?????文件????????171??2008-05-11?09:33??13\嗾俏縮放\測試圖像\人人軟件站.url
?????文件??????43718??2009-04-16?09:01??13\嗾俏縮放\測試圖像\功壋lena嗾俏.bmp
?????文件?????251078??2004-06-30?07:53??13\嗾俏縮放\測試圖像\放大后.bmp
?????文件??????27974??2004-06-30?07:53??13\嗾俏縮放\測試圖像\縮小后.bmp
?????文件??????19411??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\dibapi.obj
?????文件??????11755??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\dibapi.sbr
?????文件??????20774??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MainFrm.obj
?????文件???????3868??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MainFrm.sbr
?????文件???????6521??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\mydib.obj
?????文件???????2093??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\mydib.sbr
?????文件?????139408??2009-04-16?09:01??13\嗾俏縮放\源碼\Debug\MyDIP.exe
?????文件?????370304??2009-04-16?09:01??13\嗾俏縮放\源碼\Debug\MyDIP.ilk
?????文件??????23657??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MyDIP.obj
?????文件????6874696??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MyDIP.pch
?????文件?????467968??2009-04-16?09:01??13\嗾俏縮放\源碼\Debug\MyDIP.pdb
?????文件???????9352??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MyDIP.res
?????文件???????7124??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MyDIP.sbr
?????文件??????26058??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MyDIPDoc.obj
?????文件???????5025??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\MyDIPDoc.sbr
?????文件??????30284??2009-04-16?09:00??13\嗾俏縮放\源碼\Debug\MyDIPView.obj
?????文件???????8385??2009-04-16?09:00??13\嗾俏縮放\源碼\Debug\MyDIPView.sbr
?????文件?????106441??2009-04-15?10:17??13\嗾俏縮放\源碼\Debug\StdAfx.obj
............此處省略50個文件信息
評論
共有 條評論