FastLED 3.9.15
Loading...
Searching...
No Matches

◆ coordToU8()

template<typename T>
fl::u8 fl::gfx::coordToU8 ( T alpha)
inline

sqrt is provided by fl::sqrt overloads in math.h for:

  • All floating-point types (float, double)
  • All fixed-point types (s8x8, s12x4, s16x16, s24x8, u8x8, u12x4, u16x16, u24x8)
  • Integer types (via cast to float) Using: using fl::sqrt; (in drawStrokeLine template to find overloads via ADL) Convert a normalized [0,1] Coord value to u8 (0-255) for nscale8. Uses integer arithmetic for fixed-point types; float for float/double. Generic: for fixed-point types (those with .to_int())

Definition at line 24 of file primitives.h.

24 {
25 return (fl::u8)fl::clamp((alpha * T(255.0f) + T(0.5f)).to_int(), 0, 255);
26}
unsigned char u8
Definition s16x16x4.h:132
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT

References fl::clamp().

+ Here is the call graph for this function: