33 void make_dim(
bool monochrome ,
unsigned char & r ,
unsigned char & g ,
unsigned char & b )
45 void Gv::Overlay::operator()(
int offset_x ,
int offset_y ,
bool on )
47 int x = m_x0 + offset_x ;
48 int y = m_y0 + offset_y ;
49 if( x >= 0 && y >= 0 && x < m_data.
dx() && y < m_data.
dy() )
51 unsigned char r = m_data.
r( x , y ) ;
52 unsigned char g = m_data.
g( x , y ) ;
53 unsigned char b = m_data.
b( x , y ) ;
58 make_dim(
false , r , g , b ) ;
60 m_data.
rgb( x , y , r , g , b ) ;
71 std::string text = format ;
83 int w =
static_cast<int>(text.length()) * 9 ;
84 for(
int x = 0 ; x < (w+1) ; x++ )
86 operator()( x , -1 ,
false ) ;
87 operator()( x , +8 ,
false ) ;
89 for(
int y = -1 ; y < 8 ; y++ )
91 operator()( w , y ,
false ) ;
97 write( x0 , y0 ,
"%t" , tz ) ;
102 return datetime(t,tz) +
" " + zone(tz) ;
105 std::string Gv::Overlay::zone(
const Gv::Timezone & tz )
107 return tz.
zero() ? std::string(
"UTC") : tz.str() ;
124 return date(t,tz) +
" " + time(t,tz) ;
static BrokenDownTime utc(EpochTime epoch_time)
Converts from epoch time to UTC broken-down-time.
std::string hhmmss(const char *sep=nullptr) const
Returns the hhmmss string.
int dx() const
Returns the width.
A subsecond-resolution timestamp based on a time_t.
A holder for image data, having eight bits per sample and one or three channels.
A date (dd/mm/yyyy) class.
unsigned char v_int(unsigned char r, unsigned char g, unsigned char b)
A fast conversion from rgb to v.
unsigned char r(int x, int y) const
Returns the R-value for a point.
unsigned char b_int(unsigned char y, unsigned char u, unsigned char) g__noexcept
A fast conversion from yuv to b.
std::time_t seconds() const
Returns the offset as a signed number of seconds.
A representation of a timezone.
A simple time-of-day (hh/mm/ss) class.
unsigned char u_int(unsigned char r, unsigned char g, unsigned char b)
A fast conversion from rgb to u.
unsigned char g(int x, int y) const
Returns the G-value for a point. Returns the R-value if there is only one channel.
bool zero() const
Returns true for utc.
static EpochTime now()
Returns the current epoch time.
std::string string(Format format=yyyy_mm_dd_slash) const
Returns a string representation of the date.
Overlay(Gr::ImageData &out)
Constructor.
unsigned char g_int(unsigned char y, unsigned char u, unsigned char v) g__noexcept
A fast conversion from yuv to g.
unsigned char b(int x, int y) const
Returns the B-value for a point. Returns the R-value if there is only one channel.
static unsigned int replaceAll(std::string &s, const std::string &from, const std::string &to)
Does a global replace on string 's', replacing all occurances of sub-string 'from' with 'to'...
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".
unsigned char r_int(unsigned char y, unsigned char, unsigned char v) g__noexcept
A fast conversion from yuv to r.
unsigned char y_int(unsigned char r, unsigned char g, unsigned char b)
A fast conversion from rgb to y.
unsigned int rgb(int x, int y) const
Returns the colour of a pixel as rgb values packed into one integer.
void timestamp(int x, int y, const Gv::Timezone &)
Writes a timestamp at the given position.
static void output(const std::string &s, Tout &out_functor)
Calls an (x,y,bool) functor for all the glyph points corresponding to the given line of text...
int dy() const
Returns the height.