pixels.cpp 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "pixels.hpp"
  2. namespace simple::graphical
  3. {
  4. namespace pixel_view_details
  5. {
  6. template class impl<tag::writer, pixel_byte, pixel_byte>;
  7. template class impl<tag::reader, pixel_byte, pixel_byte>;
  8. template class impl<tag::writer, uint16_t, pixel_byte>;
  9. template class impl<tag::reader, uint16_t, pixel_byte>;
  10. template class impl<tag::writer, rgb_pixel, pixel_byte>;
  11. template class impl<tag::reader, rgb_pixel, pixel_byte>;
  12. template class impl<tag::writer, rgba_pixel, pixel_byte>;
  13. template class impl<tag::reader, rgba_pixel, pixel_byte>;
  14. } // namespace pixel_view_details
  15. template class pixel_writer<pixel_byte>;
  16. template class pixel_reader<pixel_byte>;
  17. template class pixel_writer<uint16_t, pixel_byte>;
  18. template class pixel_reader<uint16_t, pixel_byte>;
  19. template class pixel_writer<rgb_pixel, pixel_byte>;
  20. template class pixel_reader<rgb_pixel, pixel_byte>;
  21. template class pixel_writer<rgba_pixel, pixel_byte>;
  22. template class pixel_reader<rgba_pixel, pixel_byte>;
  23. // TODO: as if the stuff above wasn't enough, this can explode quadratically
  24. // maybe just force user to instantiate themselves if they are working with obscure types that happen to fit here
  25. // also are all these combinations useful??
  26. #define SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(Pixel,Vector,Param) \
  27. template void pixel_writer<Pixel,pixel_byte>::set<Vector>(const Param &, float2) const; \
  28. template void pixel_writer<Pixel,pixel_byte>::set<Vector>(const Param &, float2, range2D) const;
  29. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgb_pixel, rgb_vector, rgb_vector)
  30. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgb_pixel, rgba_vector, rgba_vector)
  31. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgb_pixel, rgb_vector, rgb_pixel)
  32. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgb_pixel, rgba_vector, rgb_pixel)
  33. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgba_pixel, rgb_vector, rgb_vector)
  34. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgba_pixel, rgba_vector, rgba_vector)
  35. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgba_pixel, rgb_vector, rgba_pixel)
  36. SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(rgba_pixel, rgba_vector, rgba_pixel)
  37. // SIMPLE_GRAPHICAL_PIXEL_WRITER_SET(uint16_t, float, uint16_t) // TODO
  38. #undef SIMPLE_GRAPHICAL_PIXEL_WRITER_SET
  39. using namespace pixel_view_details;
  40. #define SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(Tag,Pixel,Vector) \
  41. template Pixel impl<Tag,Pixel,pixel_byte>::get<Vector>(float2) const; \
  42. template Pixel impl<Tag,Pixel,pixel_byte>::get<Vector>(float2, range2D) const;
  43. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::reader, rgb_pixel, rgb_vector)
  44. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::reader, rgb_pixel, rgba_vector)
  45. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::reader, rgba_pixel, rgb_vector)
  46. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::reader, rgba_pixel, rgba_vector)
  47. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::reader, uint16_t, float)
  48. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::reader, pixel_byte, float)
  49. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::writer, rgb_pixel, rgb_vector)
  50. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::writer, rgb_pixel, rgba_vector)
  51. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::writer, rgba_pixel, rgb_vector)
  52. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::writer, rgba_pixel, rgba_vector)
  53. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::writer, uint16_t, float)
  54. SIMPLE_GRAPHICAL_PIXEL_VIEW_GET(tag::writer, pixel_byte, float)
  55. #undef SIMPLE_GRAPHICAL_PIXEL_VIEW_GET
  56. } // namespace simple::graphical