summaryrefslogtreecommitdiff
path: root/thirdparty/msdfgen/core/pixel-conversion.hpp
blob: 7e9b6d08f0a31bce351b743417ccc5655dbcc868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#pragma once

#include "arithmetics.hpp"

namespace msdfgen {

typedef unsigned char byte;

inline byte pixelFloatToByte(float x) {
    return byte(clamp(256.f*x, 255.f));
}

inline float pixelByteToFloat(byte x) {
    return 1.f/255.f*float(x);
}

}