1 #include "nr-filter-utils.h"
3 namespace NR {
5 int clamp(int const val) {
6 if (val < 0) return 0;
7 if (val > 255) return 255;
8 return val;
9 }
11 int clamp3(int const val) {
12 if (val < 0) return 0;
13 if (val > 16581375) return 16581375;
14 return val;
15 }
17 int clamp_alpha(int const val, int const alpha) {
18 if (val < 0) return 0;
19 if (val > alpha) return alpha;
20 return val;
21 }
23 } //namespace NR
25 /*
26 Local Variables:
27 mode:c++
28 c-file-style:"stroustrup"
29 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
30 indent-tabs-mode:nil
31 fill-column:99
32 End:
33 */
34 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :