⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commonlib.h

📁 开发PDA的照相以及照片传输的代码
💻 H
字号:
/******************************************************************************
 * Module Name :  CommonLib.h
 *
 * Project : HTC Camera SDK
 *
 * Purpose: The header file define the common classes which provides
 *			the utility functions for camera demo program. 
 *
 * Copyright (c) 2004, HTC, Inc.
 *
 ******************************************************************************/

#ifndef _HTC_CAMERADEMO_COMMONLIB_
#define _HTC_CAMERADEMO_COMMONLIB_

/////////////////////////////////////////////////////////////////////////////
// CHTCUtilityFunc class:

class CHTCUtilityFunc  
{
public:
	/**************************************************************************\
	*	Purpose :  Convert YUV422 data to RGB888 format.
	*
	*	Parameters :
	*		pSrc -> the source buffer
	*		nSrcBufSize -> the source buffer length
	*		nWidth -> the width of the source frame
	*		nHeight -> the height of the source frame
	*		pDst -> the destination buffer
	*		nDstBufSize -> the destination buffer length
	*
	*	Return value :	It returns false if it fails. Otherwise, it returns true.
	\**************************************************************************/
	static BOOL YUV422toRGB888(PBYTE pSrc, int nSrcBufSize, int nWidth, int nHeight, PBYTE pDst, int nDstBufSize);


	/**************************************************************************\
	*	Purpose :  Convert YUV420 data to RGB888 format.
	*
	*	Parameters :
	*		pYUV420 -> the source buffer, YUV420 format
	*		pRGB -> the destination buffer, RGB888 format
	*		nWidth -> the width of the source frame
	*		nHeight -> the height of the source frame
	*
	*	Return value :	It returns false if it fails. Otherwise, it returns true.
	\**************************************************************************/
	static int YUV420toRGB888(PBYTE pYUV420,PBYTE pRGB,int nWidth,int nHeight);


	/**************************************************************************\
	*	Purpose :  Convert RGB565 data to RGB888 format.
	*
	*	Parameters :
	*		pSrc -> the source buffer, RGB565 format
	*		pDsc -> the destination buffer, RGB888 format
	*		nWidth -> the width of the source frame
	*		nHeight -> the height of the source frame
	*
	*	Return value :	It returns false if it fails. Otherwise, it returns true.
	\**************************************************************************/
	static int RGB565toRGB888(PBYTE pSrc,PBYTE pDsc,int nWidth,int nHeight);


	/**************************************************************************\
	*	Purpose :  rotate 90 degree to right and save to the input image as Bitmap file.
	*
	*	pSrc    :  input the image buffer (format: YUV422 (YVYU)
	*
	*	FileName:  the full path to save the captured image
	*
	*	nWidth	:  the width of the captured image
	*
	*	nHeight :  the height of the capture image		
	*
	*	Return value :	It returns false if it fails. Otherwise,it returns true.  
	\**************************************************************************/
	static BOOL SaveAsBMP(PBYTE pSrc, LPCTSTR FileName, int nWidth, int nHeight);

	/**************************************************************************\
	*	Purpose :  Scale down the source image size(RGB888 format) with fixed ratio.
	*
	*	Parameters :
	*		pSrc -> source buffer
	*		nSrcWidth -> the width of the source frame
	*		nSrcHeight -> the height of the source frame
	*		pDst -> destination buffer
	*		nDstWidth -> the width of destination frame
	*		nDstHeight -> the height of the destination frame
	*
	*	Return value :	It returns false if it fails. Otherwise, it returns true.
	\**************************************************************************/
	static BOOL ShrinkRGB888(PBYTE pSrc, int nSrcWidth, int nSrcHeight,
							 PBYTE pDst, int nDstWidth, int nDstHeight);

	/**************************************************************************\
	*	Purpose :  Rotate Left the source image size(RGB888 format) .
	*
	*	Parameters :
	*		pSrc -> source buffer
	*		pDst -> destination buffer
	*		nSrcW -> the width of the source frame
	*		nSrcH -> the height of the source frame
	*		nBpp -> bits per pixel
	*
	*	Return value :	It returns false if it fails. Otherwise, it returns true.
	\**************************************************************************/
	static BOOL RotateMemBufferRight(PBYTE pSrc, PBYTE pDsc,int nSrcW, int nSrcH, int nBpp=24);

	// useless constructor & destructor
#ifdef _DEBUG
	CHTCUtilityFunc();
	virtual ~CHTCUtilityFunc();
#endif
};

/////////////////////////////////////////////////////////////////////////////
// CHTCDlgAbout class:

class CHTCDlgAbout
{
public:
	CHTCDlgAbout() {};

public:
	static int DoModal(HINSTANCE hInst, HWND hwnd);

private:
	static BOOL CALLBACK DlgProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -