Растяжение изображения
[Функция, связанная с этой страницей, класс окна MCIWnd, является устаревшей функцией. Он был заменен МедиаПлеером . MediaPlayer оптимизирован для Windows 10 и Windows 11. Корпорация Майкрософт настоятельно рекомендует использовать новый код MediaPlayer вместо класса MCIWnd Windowпо возможности. Корпорация Майкрософт предлагает, что существующий код, использующий устаревшие API, будет перезаписан для использования новых API, если это возможно.]
В следующем примере растягиваются изображения видеоклипа. Он увеличивает размеры прямоугольника назначения с помощью макроса MCIWndPutDest. Размер области воспроизведения остается неизменным, поэтому результатом является искаженное, увеличенное изображение. В примерах используется функция MCIWndPutDest для изменения положения целевого прямоугольника относительно области воспроизведения, обеспечивая способ просмотра разных частей растянутого изображения.
extern RECT rCurrent, rDest;
case WM_COMMAND:
switch (wParam)
{
case IDM_CREATEMCIWND:
g_hwndMCIWnd = MCIWndCreate(hwnd,
g_hinst,
WS_CHILD | WS_VISIBLE,
"sample.avi");
break;
case IDM_STRETCHIMAGE: // stretch destination RECT 3:2,
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rDest.top = rCurrent.top; // new boundaries
rDest.right = rCurrent.right;
rDest.left = rCurrent.left +
((rCurrent.left - rCurrent.right) * 3);
rDest.bottom = rCurrent.top +
((rCurrent.bottom - rCurrent.top) * 2);
MCIWndPutDest(g_hwndMCIWnd, &rDest); // new destination
break;
case IDM_MOVEDOWN: // move toward bottom of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.top -= 100; // new boundaries
rCurrent.bottom -= 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
case IDM_MOVEUP: // move toward top of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.top += 100; // new boundaries
rCurrent.bottom += 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
case IDM_MOVELEFT: // move toward left edge of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.right += 100; // new boundaries
rCurrent.left += 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
case IDM_MOVERIGHT: // move toward right edge of image
MCIWndGetDest(g_hwndMCIWnd, &rCurrent); // destination RECT
rCurrent.right -= 100; // new boundaries
rCurrent.left -= 100;
MCIWndPutDest(g_hwndMCIWnd, &rCurrent); // new destination
break;
}
break;
// Handle other messages here.