15#define VTFPP_FORMAT_CHECK(format, bo) \
16 static_assert(std::is_trivially_copyable_v<format##_##bo> && sizeof(format##_##bo) == ImageFormatDetails::bpp(ImageFormat::format) / 8)
18#define VTFPP_FORMAT(format, bo, ...) \
19 struct format##_##bo { \
20 static constexpr auto FORMAT = ImageFormat::format; \
22 }; VTFPP_FORMAT_CHECK(format, bo)
24#define VTFPP_FORMAT_INHERITED(format, parent) \
25 struct format##_LE : parent##_LE { \
26 static constexpr auto FORMAT = ImageFormat::format; \
27 }; VTFPP_FORMAT_CHECK(format, LE); \
28 struct format##_BE : parent##_BE { \
29 static constexpr auto FORMAT = ImageFormat::format; \
30 }; VTFPP_FORMAT_CHECK(format, BE)
153#undef VTFPP_FORMAT_INHERITED
155#undef VTFPP_FORMAT_CHECK
322 if (imageData.empty() || imageData.size() %
sizeof(P) != 0 || !channel) {
326 std::span pixels{
reinterpret_cast<const P*
>(imageData.data()), imageData.size() /
sizeof(P)};
328 std::vector<std::byte> out(imageData.size() /
sizeof(P) *
sizeof(C));
329 BufferStream stream{out,
false};
331 for (
const auto& pixel : pixels) {
332 stream << (pixel.*channel)();