You.i Engine
YiClosedCaptionsRenderer.h
Go to the documentation of this file.
1 #ifndef _YI_CLOSED_CAPTIONS_RENDERER_H_
2 #define _YI_CLOSED_CAPTIONS_RENDERER_H_
3 
6 #include "utility/YiColor.h"
7 #include "utility/YiString.h"
8 
17 {
18 public:
22  enum class TextAnchorPoint
23  {
35  Center
36  };
37 
42  {
43  Left,
44  Center,
45  Right
46  };
47 
52  {
53  Top,
54  Center,
55  Bottom
56  };
57 
61  enum class Lifetime
62  {
63  UntilNextBegin,
64  UntilRemoved
65  };
66 
72  struct Span
73  {
74  Span();
75 
77 
79  bool italic;
80  bool bold;
81  bool underline;
82  float fontSize;
83 
86  };
87 
91  struct Cue
92  {
93  Cue();
94 
98  CYIString GetText() const;
99 
103  void RestyleCue(const CYIClosedCaptionsStylingBridge::Style &userStyle, float videoHeight);
104 
108  std::vector<CYITextSceneNode::YI_TEXT_STYLE_DEF> GenerateTextSceneNodeStyles() const;
109 
110  std::vector<Span> spans;
111 
113 
114  glm::vec2 position;
118 
119  float textWidth;
120  float textHeight;
121 
123  uint64_t expirationTimeMs;
124  };
125 
127 
131  virtual void Clear() = 0;
132 
138  virtual void Begin() = 0;
139 
145  virtual void End() = 0;
146 
150  virtual void AddCue(const Cue &cue) = 0;
151 
155  virtual void RemoveCues(const CYIString &cueText) = 0;
156 
160  virtual void OnVideoTimeUpdated(uint64_t videoTimeMs) = 0;
161 };
162 
163 #endif
An interface that describes a class that can render closed captions.
Definition: YiClosedCaptionsRenderer.h:16
CYIColor fontColor
The font color. Defaults to white.
Definition: YiClosedCaptionsRenderer.h:84
virtual void OnVideoTimeUpdated(uint64_t videoTimeMs)=0
uint64_t expirationTimeMs
The time at which the cue should be removed, in video time. If 0, the cue remains until removed by th...
Definition: YiClosedCaptionsRenderer.h:123
CYIColor characterBackgroundColor
The character background color. Defaults to transparent.
Definition: YiClosedCaptionsRenderer.h:85
CYIColor windowColor
The window background color. Defaults to 50% transparent black.
Definition: YiClosedCaptionsRenderer.h:112
virtual void Clear()=0
TextAnchorPoint
Definition: YiClosedCaptionsRenderer.h:22
TextAnchorPoint anchorPoint
The anchor point of the text box. Defaults to CENTER.
Definition: YiClosedCaptionsRenderer.h:115
virtual void RemoveCues(const CYIString &cueText)=0
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
CYIString text
Definition: YiClosedCaptionsRenderer.h:76
float textHeight
The height of the text box. Defaults to 0. This is used for positionning only – the height of the te...
Definition: YiClosedCaptionsRenderer.h:120
TextHorizontalAlignment
Definition: YiClosedCaptionsRenderer.h:41
bool italic
True if the font should be italic.
Definition: YiClosedCaptionsRenderer.h:79
float fontSize
The font size in pixels, relative to the video height.
Definition: YiClosedCaptionsRenderer.h:82
virtual void AddCue(const Cue &cue)=0
Definition: YiClosedCaptionsRenderer.h:72
Lifetime lifetime
An indication of when the cue should be removed.
Definition: YiClosedCaptionsRenderer.h:122
float textWidth
The width of the text box. Defaults to -1, which indicates &#39;use full video width&#39;.
Definition: YiClosedCaptionsRenderer.h:119
virtual ~IYIClosedCaptionsRenderer()
Definition: YiClosedCaptionsRenderer.h:126
virtual void End()=0
Definition: YiClosedCaptionsStylingBridge.h:93
std::vector< Span > spans
The spans of text.
Definition: YiClosedCaptionsRenderer.h:110
TextVerticalAlignment
Definition: YiClosedCaptionsRenderer.h:51
glm::vec2 position
The position within the video frame. In pixels.
Definition: YiClosedCaptionsRenderer.h:114
Lifetime
Definition: YiClosedCaptionsRenderer.h:61
virtual void Begin()=0
bool underline
True if the font should be underlined.
Definition: YiClosedCaptionsRenderer.h:81
Definition: YiClosedCaptionsRenderer.h:91
TextVerticalAlignment verticalAlignment
The vertical alignment of the text within the box. Defaults to TextVerticalAlignment::Top.
Definition: YiClosedCaptionsRenderer.h:117
A class used to represent a color value.
Definition: YiColor.h:31
bool bold
True if the font should be bold.
Definition: YiClosedCaptionsRenderer.h:80
TextHorizontalAlignment horizontalAlignment
The horizontal alignment of the text within the box. Defaults to ALIGN_CENTER.
Definition: YiClosedCaptionsRenderer.h:116
CYIString fontFamily
Definition: YiClosedCaptionsRenderer.h:78