pub fn adapt_for_encode<'a>(
data: &'a [u8],
descriptor: PixelDescriptor,
width: u32,
rows: u32,
stride: usize,
supported: &[PixelDescriptor],
) -> Result<Adapted<'a>, At<ConvertError>>Expand description
Negotiate format and convert pixel data for encoding.
Uses ConvertIntent::Fastest — minimizes conversion cost.
If the input already matches one of the supported formats, returns
Cow::Borrowed (zero-copy). Otherwise, converts to the best match.
§Arguments
data- Raw pixel bytes,rows * stridebytes minimum.descriptor- Format of the input data.width- Pixels per row.rows- Number of rows.stride- Bytes between row starts (usewidth * descriptor.bytes_per_pixel()for packed).supported- Formats the encoder accepts.