ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
ARVideoView.h
Go to the documentation of this file.
1/*
2 * ARVideoView.h
3 * artoolkitX
4 *
5 * This file is part of artoolkitX.
6 *
7 * artoolkitX is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * artoolkitX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * As a special exception, the copyright holders of this library give you
21 * permission to link this library with independent modules to produce an
22 * executable, regardless of the license terms of these independent modules, and to
23 * copy and distribute the resulting executable under terms of your choice,
24 * provided that you also meet, for each linked independent module, the terms and
25 * conditions of the license of that module. An independent module is a module
26 * which is neither derived from nor based on this library. If you modify this
27 * library, you may extend this exception to your version of the library, but you
28 * are not obligated to do so. If you do not wish to do so, delete this exception
29 * statement from your version.
30 *
31 * Copyright 2018 Realmax, Inc.
32 *
33 * Author(s): Philip Lamb.
34 *
35 */
36
37#ifndef ARVIDEOVIEW_H
38#define ARVIDEOVIEW_H
39
40#include <ARX/Platform.h>
41#include <ARX/ARVideoSource.h>
42
43#include <ARX/AR/ar.h>
44#include <ARX/ARG/arg.h>
45
55class ARX_EXTERN ARVideoView {
56
57public:
58
59 struct Size {
60 int width;
61 int height;
62 };
64 H_ALIGN_LEFT,
65 H_ALIGN_CENTRE,
66 H_ALIGN_RIGHT
67 };
68 enum class VerticalAlignment {
69 V_ALIGN_TOP,
70 V_ALIGN_CENTRE,
71 V_ALIGN_BOTTOM
72 };
73 enum class ScalingMode {
74 SCALE_MODE_FIT,
75 SCALE_MODE_FILL,
76 SCALE_MODE_STRETCH,
77 SCALE_MODE_1_TO_1
78 };
79
81 bool initWithVideoSource(const ARVideoSource& vs, const int contextWidth, const int contextHeight);
82 void getViewport(int32_t viewport[4]) const;
83 void draw(ARVideoSource* vs);
84 void drawDebugImage(const uint8_t *image, int pyramidLevel);
86
87 HorizontalAlignment horizontalAlignment() const;
88 void setHorizontalAlignment(const HorizontalAlignment hAlign);
89 VerticalAlignment verticalAlignment() const;
90 void setVerticalAlignment(const VerticalAlignment vAlign);
91 ScalingMode scalingMode() const;
92 void setScalingMode(const ScalingMode scaling);
93 bool distortionCompensation() const;
94 void setDistortionCompensation(const bool distortionCompensation);
95 bool rotate90() const;
96 void setRotate90(const bool rotate90);
97 bool flipH() const;
98 void setFlipH(const bool flipH);
99 bool flipV() const;
100 void setFlipV(const bool flipV);
101 Size contextSize() const;
102 void setContextSize(const Size size);
103
104private:
105 void update();
106 ARGL_CONTEXT_SETTINGS_REF m_arglContextSettings;
107 enum class DrawType {None, Main, Debug};
108 DrawType m_drawTypeSet;
109 AR2VideoTimestampT m_drawTime;
110 int m_contentWidth;
111 int m_contentHeight;
112 int m_contextWidth;
113 int m_contextHeight;
114 int32_t m_viewport[4];
115 HorizontalAlignment m_hAlign;
116 VerticalAlignment m_vAlign;
117 ScalingMode m_scalingMode;
118 bool m_distortionCompensation;
119 bool m_rotate90;
120 bool m_flipH;
121 bool m_flipV;
122};
123
124#endif // !ARVIDEOVIEW_H
artoolkitX core routines.
A collection of useful graphics routines for artoolkitX.
A video source provides video frames to the artoolkitX tracking module.
Definition: ARVideoSource.h:53
ARVideoView draws the output of an ARVideoSource to a rendering context, usually for the purposes of ...
Definition: ARVideoView.h:55
HorizontalAlignment
Definition: ARVideoView.h:63
ScalingMode
Definition: ARVideoView.h:73
VerticalAlignment
Definition: ARVideoView.h:68
Definition: arg_private.h:48
A structure to hold a timestamp in seconds and microseconds, with arbitrary epoch.
Definition: ar.h:139
Definition: ARVideoView.h:59
int width
Definition: ARVideoView.h:60
int height
Definition: ARVideoView.h:61