convert_owned

Function convert_owned 

Source
pub fn convert_owned<OWNED, SRC, DEST>(
    source: OWNED,
) -> Result<impl HasRowChunksExact<DEST>, Error>
where OWNED: OwnedImageStride<SRC>, SRC: PixelFormat, DEST: PixelFormat,
Expand description

Convert input, a frame implementing OwnedImageStride<SRC>, into an output implementing HasRowChunksExact<DEST>.

The source data will be moved, not copied, into the destination if no format change is required, otherwise an image with a newly allocated image buffer will be returned.

This is a general purpose function which should be able to convert between many types as efficiently as possible. In case no data needs to be copied, no data is copied.

For a version which converts into a pre-allocated buffer, use convert_into (which will copy the image even if the format remains unchanged).