pub fn adapt_for_encode<'a>(
data: &'a [u8],
descriptor: PixelDescriptor,
width: u32,
rows: u32,
stride: usize,
supported: &[PixelDescriptor],
) -> Result<Adapted<'a>, At<ConvertError>>👎Deprecated since 0.2.15:
use adapt_for_encode_cow
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.
A SignalRange mismatch with every supported
format fails with ConvertError::NoPath: no Narrow↔Full kernels
exist, and neither the zero-copy paths nor the planner will relabel a
range without rescaling. Offer a same-range target to accept narrow
input verbatim.
§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.