decodeEquirectHdrImage function Assets and loading
Decodes a high-dynamic-range equirectangular image (EquirectImageFormat.radianceHdr
or EquirectImageFormat.openExr) from bytes to linear float pixels, or
returns null for a low-dynamic-range image (the caller decodes those with
the platform image codec as sRGB).
maxWidth box-downsamples a source wider than it during decode. Runs pure
on the CPU, so it is safe to call on a background isolate.
Implementation
DecodedHdr? decodeEquirectHdrImage(Uint8List bytes, {int? maxWidth}) {
switch (detectEquirectImageFormat(bytes)) {
case EquirectImageFormat.radianceHdr:
return decodeRadianceHdr(bytes, maxWidth: maxWidth);
case EquirectImageFormat.openExr:
return decodeOpenExr(bytes, maxWidth: maxWidth);
case EquirectImageFormat.ldr:
return null;
}
}