BlendText.h
资源名称:Direct90.rar [点击查看]
上传用户:maxzhb99
上传日期:2013-03-13
资源大小:48k
文件大小:2k
源码类别:
DirextX编程
开发平台:
Visual C++
- // BlendText.h: interface for the CBlendText class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_BLENDTEXT_H__54C4A3EA_7E0C_477E_ABC6_2E2AB68408E8__INCLUDED_)
- #define AFX_BLENDTEXT_H__54C4A3EA_7E0C_477E_ABC6_2E2AB68408E8__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include <dshow.h>
- #include <commctrl.h>
- #include <commdlg.h>
- #include <stdio.h>
- #include <tchar.h>
- #include <atlbase.h>
- #include "common.h"
- //
- // Constants
- //
- #define TRANSPARENCY_VALUE (0.5f)
- #define PURE_WHITE RGB(255,255,255)
- #define ALMOST_WHITE RGB(250,250,250)
- #define BLEND_TEXT TEXT("This is a demonstration of alpha-blended dynamic text. ")
- #define DYNAMIC_TEXT_SIZE 255
- #define DEFAULT_FONT_NAME TEXT("Impact ")
- #define DEFAULT_FONT_STYLE TEXT("Regular ")
- #define DEFAULT_FONT_SIZE 12
- #define DEFAULT_FONT_COLOR RGB(255,0,0)
- #define MAX_FONT_SIZE 25
- //
- // Constants
- //
- const float X_EDGE_BUFFER=0.05f; // Pixel buffer between bitmap and window edge
- // (represented in composition space [0 - 1.0f])
- const float Y_EDGE_BUFFER=0.05f;
- const int UPDATE_TIMER = 2000;
- const int UPDATE_TIMEOUT = 2000; // 2 seconds between ticker movements
- class CBlendText
- {
- public:
- HFONT UserSelectFont(HWND hWnd);
- HFONT SetTextFont(HWND hwndApp,BOOL bShowDialog);
- void UpdateText(IVMRWindowlessControl *pWC,HWND hwndApp);
- HRESULT BlendText(IVMRWindowlessControl *pWC,HWND hwndApp, TCHAR *szNewText,HFONT hFont);
- CBlendText();
- virtual ~CBlendText();
- private:
- void SetColorRef(VMRALPHABITMAP& bmpInfo);
- private:
- //
- // Global data
- //
- TCHAR g_szAppText[DYNAMIC_TEXT_SIZE];
- int gnTimer;
- float g_fBitmapCompWidth; // Width of bitmap in composition space units
- int g_nImageWidth; // Width of text bitmap
- // Text font information
- HFONT g_hFont;
- LONG g_lFontPointSize ;
- COLORREF g_rgbColors ;
- TCHAR g_szFontName[100] ;
- TCHAR g_szFontStyle[32];
- // Destination rectangle used for alpha-blended text
- // RMALIZEDRECT g_rDest;
- public:
- IVMRMixerBitmap *pBMP;
- };
- #endif // !defined(AFX_BLENDTEXT_H__54C4A3EA_7E0C_477E_ABC6_2E2AB68408E8__INCLUDED_)