我想为Adobe Premiere编写视频过滤器,我需要打印/绘制/渲染一些文本到输出视频帧中。
查看adobe premiere cs4 sdk,我找不到一个快速的答案--有可能吗?
请提供一些样品!
谢谢!
发布于 2010-04-21 15:06:34
我将尝试实现一些策略:
将文本绘制为帧大小的位图(VideoHandle->
更新 alt text http://img413.imageshack.us/img413/6201/adobe.jpg工作示例,使用来自SDK的Simple_Video_Filter示例...
在xFilter (short selector,VideoHandle theData)函数的开头创建带文本的位图:
TCHAR szBuffer[50] = {0};
RECT rect;
HDC hdc = GetDC(NULL);
int iLength = 0;
iLength = wsprintf(szBuffer, "Hello World!");
BITMAPINFO bmInfo;
memset(&bmInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
bmInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bmInfo.bmiHeader.biWidth=100;
bmInfo.bmiHeader.biHeight=15;
bmInfo.bmiHeader.biPlanes=1;
bmInfo.bmiHeader.biBitCount = 32;
bmInfo.bmiHeader.biCompression = BI_RGB;
//create a temporary dc in memory.
HDC pDC = GetDC(0);
HDC TmpDC=CreateCompatibleDC(pDC);
//create a new bitmap and select it in the memory dc
BYTE *pbase;
HBITMAP TmpBmp=CreateDIBSection(pDC, &bmInfo,DIB_RGB_COLORS,(void**)&pbase,0,0);
HGDIOBJ TmpObj=SelectObject(TmpDC,TmpBmp);
SetRect(&rect, 0, 0, 100, 15);
DrawText(TmpDC, szBuffer, iLength, &rect, 32);在中间设置过滤器的位置,而不是
redSource = (redSource + redAdd) & 0x000000ff;
greenSource = (greenSource + greenAdd) & 0x000000ff;
blueSource = (blueSource + blueAdd) & 0x000000ff;使用
int x = vert;
int y = horiz;
if(x < 215 && y < 300)
{
COLORREF c = GetPixel(TmpDC,y-200, 215 - x);
if(0 == ((int)GetRValue(c)+(int)GetGValue(c)+(int)GetBValue(c)))
{
redSource =255;
greenSource =255;
blueSource =255;
}
}并在函数结束时清除内存
SelectObject(TmpDC,TmpObj);
DeleteDC(TmpDC);PS有朝一日:)需要在内存中存储一次位图,而不是每帧创建一次…
https://stackoverflow.com/questions/2513403
复制相似问题