pixel-conversion.hpp 229 B

12345678910111213141516
  1. #pragma once
  2. #include "arithmetics.hpp"
  3. namespace msdfgen {
  4. inline byte pixelFloatToByte(float x) {
  5. return byte(~int(255.5f-255.f*clamp(x)));
  6. }
  7. inline float pixelByteToFloat(byte x) {
  8. return 1.f/255.f*float(x);
  9. }
  10. }