代码之家  ›  专栏  ›  技术社区  ›  Maksym Gontar

C++ Adobe PrimeIVE视频过滤器——输出视频帧中的打印/绘制/渲染文本

  •  2
  • Maksym Gontar  · 技术社区  · 16 年前

    调查 adobe premiere cs4 sdk 我找不到一个快速的答案-可能吗?

    请提供一些样品!

    谢谢!

    1 回复  |  直到 16 年前
        1
  •  1
  •   Maksym Gontar    16 年前

    1. 用GDI将文本绘制成帧大小的位图(VideoHandle->双曲线->ppixFuncs->ppixGetBounds(边界)
    2. 重叠帧像素(VideoHandle->源)位图像素

    更新 alt text http://img413.imageshack.us/img413/6201/adobe.jpg

    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[某天:)]需要在内存中存储一次位图,而不是每帧创建一次。。。