VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gvoverlay.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 ///
18 /// \file gvoverlay.h
19 ///
20 
21 #ifndef GV_OVERLAY__H
22 #define GV_OVERLAY__H
23 
24 #include "gdef.h"
25 #include "gvtimezone.h"
26 #include "gdatetime.h"
27 #include "grpng.h"
28 #include <vector>
29 #include <string>
30 
31 namespace Gv
32 {
33  class Overlay ;
34 }
35 
36 namespace Gr
37 {
38  class Glyph ;
39 }
40 
41 /// \class Gv::Overlay
42 /// A class that can add a text overlay to an image.
43 ///
45 {
46 public:
47  explicit Overlay( Gr::ImageData & out ) ;
48  ///< Constructor.
49 
50  void write( int x , int y , const std::string & format , const Gv::Timezone & ) ;
51  ///< Writes the string at the given position, with text-substitution
52  ///< for "%t".
53 
54  void timestamp( int x , int y , const Gv::Timezone & ) ;
55  ///< Writes a timestamp at the given position.
56 
57 private:
58  Overlay( const Overlay & ) ;
59  void operator=( const Overlay & ) ;
60  static std::string zone( const Gv::Timezone & ) ;
61  static std::string timestamp( G::EpochTime , const Gv::Timezone & ) ;
62  static std::string datetime( G::EpochTime , const Gv::Timezone & ) ;
63  static std::string date( G::EpochTime , const Gv::Timezone & ) ;
64  static std::string time( G::EpochTime , const Gv::Timezone & ) ;
65  friend class Gr::Glyph ;
66  void operator()( int x , int y , bool b ) ;
67 
68 private:
69  Gr::ImageData & m_data ;
70  int m_x0 ;
71  int m_y0 ;
72 } ;
73 
74 #endif
A subsecond-resolution timestamp based on a time_t.
Definition: gdatetime.h:39
A holder for image data, having eight bits per sample and one or three channels.
Definition: grimagedata.h:46
A representation of a timezone.
Definition: gvtimezone.h:35
A class that can add a text overlay to an image.
Definition: gvoverlay.h:44
A class for mapping characters to 8x8 glyphs.
Definition: grglyph.h:36
Overlay(Gr::ImageData &out)
Constructor.
Definition: gvoverlay.cpp:64
void write(int x, int y, const std::string &format, const Gv::Timezone &)
Writes the string at the given position, with text-substitution for "%t".
Definition: gvoverlay.cpp:69
void timestamp(int x, int y, const Gv::Timezone &)
Writes a timestamp at the given position.
Definition: gvoverlay.cpp:95