Microsoft DirectX 9.0

IMSVidVideoRenderer::put_ClippedSourceRect

This topic applies to Windows XP only.

The put_ClippedSourceRect method specifies the clipping rectangle on the video source.

Syntax

HRESULT put_ClippedSourceRect(
  IMSVidRect*  pRect
);

Parameters

  pRect

[in]  Pointer to an IMSVidRect interface that specifies the rectangle.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

If the current clipping mode is sslClipByClipRect, the VMR clips the video image to the video source rectangle and stretches this to fill the Video Control's video window. For more information, see IMSVidVideoRenderer::put_SourceSize.

Example Code

The following example clips the video image to the upper left corner of the source rectangle.

CComPtr<IMSVidVideoRenderer> pVideo;
HRESULT hr = pVideoControl->get_VideoRendererActive(&pVideo);
if (SUCCEEDED(hr))
{
    long lWidth, lHeight;
    CComPtr<IMSVidRect> pRect;
    
    hr = pVideo->get_AvailableSourceRect(&pRect);
    pRect->get_Height(&lHeight);
    pRect->get_Width(&lWidth);
    pRect->put_Height(lHeight / 2);
    pRect->put_Width(lWidth / 2);
    pVideo->put_SourceSize(sslClipByClipRect);
    hr = pVideo->put_ClippedSourceRect(pRect);
}

See Also