ESP32VGA
ESP32 VGA Controller and Graphics Library
VGAUtils.h
1
/*
2
Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com)
3
Copyright (c) 2018 Fabrizio Di Vittorio.
4
All rights reserved.
5
6
This file is part of ESP32VGA Library.
7
8
ESP32VGA is free software: you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation, either version 3 of the License, or
11
(at your option) any later version.
12
13
ESP32VGA is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with ESP32VGA. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
23
24
#ifndef _VGAUTILS_H_INCLUDED
25
#define _VGAUTILS_H_INCLUDED
26
27
28
29
30
namespace
ESP32VGA
{
31
32
33
34
template
<
typename
T>
35
const
T & max(
const
T & a,
const
T & b)
36
{
37
return
(a < b) ? b : a;
38
}
39
40
41
template
<
typename
T>
42
const
T & min(
const
T & a,
const
T & b)
43
{
44
return
!(b < a) ? a : b;
45
}
46
47
48
template
<
typename
T>
49
const
T & clamp(
const
T & v,
const
T & lo,
const
T & hi)
50
{
51
return
(v < lo ? lo : (v > hi ? hi : v));
52
}
53
54
55
56
57
58
}
// end of namespace
59
60
61
62
63
64
65
#endif // _VGAUTILS_H_INCLUDED
ESP32VGA
Definition:
VGACanvas.cpp:29
Generated by
1.8.14