www.pudn.com > DirectDraw.rar > DirectDisplay2.h, change:2007-09-19,size:3634b


/* 
 *----------------------------------------------------------------------------- 
 *       Name				DirectDisplay.h 
 *       Purpose			 
 *       Development Kit	Microsoft DirectX SDK, Visual C++ 6.00  
 *       Author				Zhou zheng xiang 
 *       Date          		2003/07/18 
 * 
 * 
 *       Description		YUV420 -> Display 
 *		  
 *        
 *----------------------------------------------------------------------------- 
*/ 
 
#if !defined(_DIRECTDISPLAY_H_INCLUDED_) 
#define _DIRECTDISPLAY_H_INCLUDED_ 
 
#include <ddraw.h> 
#include "DVSPlayerSDK.h" 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
typedef enum 
{ 
	VOUT_MODE_NONE, 
	VOUT_MODE_RGB555, 
	VOUT_MODE_RGB565, 
	VOUT_MODE_RGB24, 
	VOUT_MODE_RGB32, 
	VOUT_MODE_YUY2, 
	VOUT_MODE_YV12, 
	VOUT_MODE_UYVY 
}VOUT_MODE; 
 
//要创建的表面的类型 
//#define 	VIDEO_MODE_RGB		1001 
 
//typedef void (CALLBACK *DrawOSD)(HDC hDC,SIZE *pImageSize,DWORD dwUser); 
typedef void (CALLBACK *VideoCallBack)(DWORD dwWidth,DWORD dwHeight,BYTE *lpData,DWORD dwLineLength,DWORD dwUser); 
typedef HRESULT (WINAPI* DirectDrawCreateEx_)( GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter ); 
 
class CDirectDisplay   
{ 
public: 
	CDirectDisplay(); 
	virtual ~CDirectDisplay(); 
	 
	void SetDisplayRect(BOOL bDrawRect,RECT *pRect); 
	BOOL CreateDDraw(HWND hWnd); 
//	BOOL CheckDisplayIsSuppor(DWORD dwVideoFormat); 
	BOOL InitDDraw(DWORD dwWidth,DWORD dwHeight,DWORD dwVideoFormat = 0); 
	DWORD GetOutputVideoMode(); 
	BYTE* GetBackBuffer(); 
	BOOL SetDrawcallback(DrawCallback pOSD,LPVOID dwUser); 
	BOOL SetVideoCallback(VideoCallBack videocallback,DWORD dwUser); 
	void UpdateImage(RECT* Rectdes); 
	BOOL DrawImageFromYUV(PBYTE  in_Y,PBYTE in_U,PBYTE in_V,int nStride,RECT *Rectdes = NULL); 
	BOOL SetClipperWnd(HWND hWnd); 
	BOOL CaptureImage(int nImageType,int nQuality,unsigned char *pImageBuf, unsigned long *pnImageSize); 
	void UpdateBounds(); 
private: 
	BYTE			*lpSurface; 
	DWORD			m_lPitch; 
	DWORD			m_Memflag; 
	HWND			m_hWnd; 
	RECT			m_rcWindow; 
	DWORD			m_nWidth,m_nHeight; 
    int				iScreenWidth,iScreenHeight; 
	DrawCallback	m_pDrawOSD; 
	VideoCallBack	m_videocallback; 
	LPVOID			m_dwUser; 
	DWORD			m_dwvideouser; 
	DWORD			m_PixelFormat; 
	LPDIRECTDRAW7        m_pDD; 
	LPDIRECTDRAWSURFACE7 m_pddsFrontBuffer; 
	LPDIRECTDRAWSURFACE7 m_pddsBackBuffer; 
	LPDIRECTDRAWSURFACE7 m_pddsOSDBuffer; 
	 
	BOOL			m_bDrawRect; 
	RECT			m_DrawRect; 
 
	void ReleaseObject(); 
	BOOL UpdataImage(RECT *Rectdes = NULL); 
	void GetShowRect(LPRECT lpRect); 
	DWORD CreateRGBSurface(HWND hWnd,DWORD dwWidth,DWORD dwHeight);	 
	DWORD CreateYUVSurface(HWND hWnd,DWORD dwWidth,DWORD dwHeight); 
	 
	void yuv2rgb_32(BYTE *puc_y, int stride_y,  
								BYTE *puc_u, BYTE *puc_v, int stride_uv,  
								BYTE *puc_out, int width_y, int height_y, 
								UINT _stride_out); 
	void yuv2rgb_24(BYTE *puc_y, int stride_y,  
								BYTE *puc_u, BYTE *puc_v, int stride_uv,  
								BYTE *puc_out, int width_y, int height_y, 
								UINT _stride_out); 
	void yuv2rgb_555(BYTE *puc_y, int stride_y,  
								 BYTE *puc_u, BYTE *puc_v, int stride_uv,  
								 BYTE *puc_out,	int width_y, int height_y, 
								 UINT _stride_out); 
	void yuv2rgb_565(BYTE *puc_y, int stride_y,  
								 BYTE *puc_u, BYTE *puc_v, int stride_uv,  
								 BYTE *puc_out, int width_y, int height_y, 
								 UINT _stride_out); 
	void yuv2ToYUYV(BYTE* lpSrcY, int SrcPitch, 
								BYTE* lpSrcU,BYTE* lpSrcV, int stride_uv,  
								BYTE* lpDst, int SrcWidth, int SrcHeight, 
								UINT _stride_out); 
 
}; 
 
#endif // !defined(_DIRECTDISPLAY_H_INCLUDED_)