pixel-conversion.hpp 252 B

12345678910111213141516171819
  1. #pragma once
  2. #include "arithmetics.hpp"
  3. namespace msdfgen {
  4. typedef unsigned char byte;
  5. inline byte pixelFloatToByte(float x) {
  6. return byte(clamp(256.f*x, 255.f));
  7. }
  8. inline float pixelByteToFloat(byte x) {
  9. return 1.f/255.f*float(x);
  10. }
  11. }