pixel-conversion.hpp 242 B

1234567891011121314151617
  1. #pragma once
  2. #include "types.h"
  3. #include "arithmetics.hpp"
  4. namespace msdfgen {
  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. }