pub fn convert(
frame: &FrameEnvelope,
target: PixelFormat,
) -> Result<FrameEnvelope, ConvertError>Expand description
Convert a frame to a different pixel format.
Works with host-resident and MappableToHost
device frames. Conversion always allocates a new output buffer, so the
additional cost of materializing device data is negligible.
§Errors
ConvertError::SameFormat— source already matchestarget; clone instead.ConvertError::Unsupported— no conversion path for this format pair.ConvertError::Access— host bytes could not be obtained (opaque device frame).
Currently supported paths:
Bgr8→Rgb8Rgb8→Bgr8Rgba8→Rgb8Rgb8→Gray8
Other conversions can be contributed by adding a match arm below.