pub unsafe extern "C-unwind" fn JxlDecoderSetImageOutCallback(
dec: *mut JxlDecoder,
format: *const JxlPixelFormat,
callback: JxlImageOutCallback,
opaque: *mut c_void,
) -> JxlDecoderStatusExpand description
Sets pixel output callback. This is an alternative to JxlDecoderSetImageOutBuffer.
This can be set when the JxlDecoderStatus::Frame event occurs, must be set when the
JxlDecoderStatus::NeedImageOutBuffer event occurs, and applies only for the current frame.
Only one of JxlDecoderSetImageOutBuffer or JxlDecoderSetImageOutCallback may be used
for the same frame, not both at the same time.
The callback will be called multiple times, to receive the image
data in small chunks. The callback receives a horizontal stripe of pixel
data, 1 pixel high, xsize pixels wide, called a scanline. The xsize here is
not the same as the full image width, the scanline may be a partial section,
and xsize may differ between calls. The user can then process and/or copy the
partial scanline to an image buffer. The callback may be called
simultaneously by different threads when using a threaded parallel runner, on
different pixels.
If JxlDecoderFlushImage is not used, then each pixel will be visited
exactly once by the different callback calls, during processing with one or
more JxlDecoderProcessInput calls. These pixels are decoded to full
detail, they are not part of a lower resolution or lower quality progressive
pass, but the final pass.
If JxlDecoderFlushImage is used, then in addition each pixel will be
visited zero or one times during the blocking JxlDecoderFlushImage call.
Pixels visited as a result of JxlDecoderFlushImage may represent a lower
resolution or lower quality intermediate progressive pass of the image. Any
visited pixel will be of a quality at least as good or better than previous
visits of this pixel. A pixel may be visited zero times if it cannot be
decoded yet or if it was already decoded to full precision (this behavior is
not guaranteed).
§Parameters
dec: decoder objectformat: format of the pixels. Object owned by user; its contents are copied internally.callback: the callback function receiving partial scanlines of pixel data.opaque: optional user data, which will be passed on to the callback, may beNULL.
§Returns
JxlDecoderStatus::Successon success,JxlDecoderStatus::Erroron error, such asJxlDecoderSetImageOutBufferalready set.