Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
displayer.cpp
Go to the documentation of this file.
1/*
2 Displayer - base class for displaying video
3
4 Copyright (C)
5 2000, Arne Schirmacher <arne@schirmacher.de>
6 2001-2007, Dan Dennedy <dan@dennedy.org>
7 2008, Joel Holdsworth <joel@airwebreathe.org.uk>
8
9  **Lumiera** is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by the
11  Free Software Foundation; either version 2 of the License, or (at your
12  option) any later version. See the file COPYING for further details.
13
14* *****************************************************************/
15
16
30#include "stage/gtk-base.hpp"
32
33#include <cmath>
34
35namespace stage {
36namespace output {
37
43
44 void
46 int widgetWidth, int widgetHeight,
47 int &imgOrg_x, int &imgOrg_y, int &imgWidth, int &imgHeight )
48 {
49 REQUIRE (0 < widgetWidth );
50 REQUIRE (0 < widgetHeight);
51 REQUIRE (0 < videoWidth );
52 REQUIRE (0 < videoHeight );
53
54 auto ratioW = double(widgetWidth ) / videoWidth;
55 auto ratioH = double(widgetHeight) / videoHeight;
56 auto scale = std::min (ratioW, ratioH);
57 imgWidth = std::lround (scale * videoWidth);
58 imgHeight = std::lround (scale * videoHeight);
59 imgOrg_x = (widgetWidth - imgWidth) / 2;
60 imgOrg_y = (widgetHeight - imgHeight) / 2;
61
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);
66 }
67
68
69}} // namespace stage::output
virtual DisplayerInput format()
Indicates the format required by the abstract put method.
Definition displayer.cpp:39
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.
Definition displayer.cpp:45
The Displayer serves as base of all video display implementations.
A set of basic GTK includes for the UI.
DisplayerInput
Supported Displayer formats.
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37