MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ is_consistent()

bool MayaFlux::IO::ImageData::is_consistent ( ) const

Check that the active variant matches the declared format.

Callers producing ImageData should invoke this to validate before handing the data to downstream consumers.

Definition at line 206 of file ImageReader.cpp.

207{
209
210 const bool has_u8 = std::holds_alternative<std::vector<uint8_t>>(pixels);
211 const bool has_u16 = std::holds_alternative<std::vector<uint16_t>>(pixels);
212 const bool has_f32 = std::holds_alternative<std::vector<float>>(pixels);
213
214 switch (format) {
215 case F::R8:
216 case F::RG8:
217 case F::RGBA8:
218 case F::BGRA8:
219 return has_u8;
220
221 case F::R16:
222 case F::RG16:
223 case F::RGBA16:
224 return has_u16;
225
226 case F::R16F:
227 case F::RG16F:
228 case F::RGBA16F:
229 return has_u16;
230
231 case F::R32F:
232 case F::RG32F:
233 case F::RGBA32F:
234 return has_f32;
235
236 default:
237 return false;
238 }
239}
ImageFormat
User-friendly image format enum.
Portal::Graphics::ImageFormat format

References MayaFlux::IO::F, format, and pixels.

Referenced by MayaFlux::IO::download_image(), MayaFlux::IO::EXRWriter::write(), and MayaFlux::IO::STBImageWriter::write().

+ Here is the caller graph for this function: