46 int widgetWidth,
int widgetHeight,
47 int &imgOrg_x,
int &imgOrg_y,
int &imgWidth,
int &imgHeight )
49 REQUIRE (0 < widgetWidth );
50 REQUIRE (0 < widgetHeight);
54 auto ratioW = double(widgetWidth ) /
videoWidth;
56 auto scale = std::min (ratioW, ratioH);
59 imgOrg_x = (widgetWidth - imgWidth) / 2;
60 imgOrg_y = (widgetHeight - imgHeight) / 2;
62 ENSURE (imgWidth <= widgetWidth);
63 ENSURE (imgWidth <= widgetWidth);
64 ENSURE (0 <= imgOrg_x and imgOrg_x < widgetWidth);
65 ENSURE (0 <= imgOrg_y and imgOrg_y < widgetHeight);
void calculateVideoLayout(int widgetWidth, int widgetHeight, int &imgOrg_x, int &imgOrg_y, int &imgWidth, int &imgHeight)
Calculates the coordinates for placing a video image inside a widget.