Advertisement
honey_the_codewitch

channel metadata

Mar 14th, 2022
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.03 KB | None | 0 0
  1. // the declaring pixel's type
  2. using pixel_type = PixelType;
  3. // this type
  4. using type = pixel_channel<pixel_type,ChannelTraits,Index,BitsToLeft>;
  5. // the name type for the channel
  6. using name_type = typename ChannelTraits::name_type;
  7. // the integer type for the channel
  8. using int_type = typename ChannelTraits::int_type;
  9. // the floating point type for the channel
  10. using real_type = typename ChannelTraits::real_type;
  11. // the declaring pixel's integer type
  12. using pixel_int_type = typename PixelType::int_type;
  13. // the number of bits to the left of this channel
  14. constexpr static const size_t bits_to_left = ChannelTraits::bit_depth!=0?BitsToLeft:0;
  15. // the total bits to the right of this channel including padding
  16. constexpr static const size_t total_bits_to_right =  ChannelTraits::bit_depth!=0?sizeof(pixel_int_type)*8-BitsToLeft-ChannelTraits::bit_depth:0;
  17. // the bits to the right of this channel excluding padding
  18. constexpr static const size_t bits_to_right =ChannelTraits::bit_depth!=0?total_bits_to_right-PixelType::pad_right_bits:0;
  19. // the name of the channel
  20. constexpr static inline const char* name() { return ChannelTraits::name(); }
  21. // the bit depth of the channel
  22. constexpr static const size_t bit_depth = ChannelTraits::bit_depth;
  23. // the mask of the channel's value
  24. constexpr static const int_type value_mask = ChannelTraits::mask;
  25. // the mask of the channel's value within the entire pixel's value
  26. constexpr static const pixel_int_type channel_mask = (value_mask>0)?pixel_int_type(pixel_int_type(value_mask)<<total_bits_to_right):pixel_int_type(0);
  27. // the minimum value for the channel
  28. constexpr static const int_type min = ChannelTraits::min;
  29. // the maximum value for the channel
  30. constexpr static const int_type max = ChannelTraits::max;
  31. // the default value for the channel
  32. constexpr static const int_type default_ = ChannelTraits::default_;  
  33. // the scale denominator
  34. constexpr static const int_type scale = ChannelTraits::scale;
  35. // the reciprocal of the scale denominator
  36. constexpr static const real_type scaler = ChannelTraits::scaler;
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement