function TVMR7.SetBitmapFromImage(Image_: TBitmap; nAlpha: word; bitmapRect: TRECT): BOOL;
var
hr: HRESULT;
nRect: VMR9NormalizedRect;
sRect, dRect: TRECT;
begin
result := false;
if (VMR7MixerBitmap =
nil)
then
begin
m_ErrorDescription := ReportError('
Can''
t set bitmap, no VMR7MixerBitmap', E_FAIL);
exit;
end;
if Image_ =
nil then
begin
alphaBitmap7.dwFlags := VMRBITMAP_DISABLE;
hr := VMR7MixerBitmap.SetAlphaBitmap(alphaBitmap7);
result := (SUCCEEDED(hr));
if result
then
bIsOverlayImage := false;
exit;
end;
// Accept only 32bit ARGB or 24bit RGB formatted image
if (Image_.PixelFormat <> pf32bit)
and (Image_.PixelFormat <> pf24bit)
then
begin
m_ErrorDescription := ReportError('
not a supported bitmap format', E_FAIL);
exit;
end;
if not PrepareDDSurface(Image_, bitmapRect)
then
exit;
if FAILED(m_pWindowless.GetVideoPosition(sRect, dRect))
then
exit;
nRect := NormalizeRect(sRect, bitmapRect);
alphaBitmap7.dwFlags := VMRBITMAP_ENTIREDDS;
alphaBitmap7.hdc := 0;
alphaBitmap7.pDDS := m_pDDSurface;
alphaBitmap7.rDest.top := nRect.top;
alphaBitmap7.rDest.left := nRect.left;
alphaBitmap7.rDest.bottom := nRect.bottom;
alphaBitmap7.rDest.right := nRect.right;
alphaBitmap7.fAlpha := nAlpha / 255.0;
alphaBitmap7.clrSrcKey := 0;
// SHOW the bitmap
hr := VMR7MixerBitmap.SetAlphaBitmap(alphaBitmap7);
// Fehler nur unter 64Bit
m_pWindowless.RepaintVideo(m_hMediaWindow, m_hMediaDC);
result := (SUCCEEDED(hr));
if result
then
bIsOverlayImage := true;
end;