Struct spng::raw::RawContext [−][src]
pub struct RawContext<R> { /* fields omitted */ }
Expand description
The raw decoding context.
Implementations
Set how chunk CRC errors should be handled for critical and ancillary chunks.
Get image width and height limits.
Returns (width, height)
Set image width and height limits, these may not be larger than (2^31)-1
.
Get chunk size and chunk cache limits.
Returns (chunk_size, cache_size)
Set chunk size and chunk cache limits, the default chunk size limit is (2^31)-1
, the default
chunk cache limit is SIZE_MAX
.
Get primary chromacities and white point as floating point numbers.
Get primary chromacities and white point in the PNG’s internal representation.
Get text information.
Note
Due to the structure of PNG files it is recommended to call this function after decode_image
.
Get the modification time.
Note
Due to the structure of PNG files it is recommended to call this function after decode_image
.
Get the EXIF
data.
Note
Due to the structure of PNG files it is recommended to call this function after decode_image
.
Get the current, to-be-decoded row’s information.
Returns unknown chunk information.
Note
Due to the structure of PNG files it is recommended to call this function after decode_image
.
Calculates decoded image buffer size for the given output format.
PNG data must have been set prior with set_png_stream
or set_png_buffer
.
pub fn decode_image(
&mut self,
out: &mut [u8],
out_format: Format,
flags: DecodeFlags
) -> Result<(), Error>
pub fn decode_image(
&mut self,
out: &mut [u8],
out_format: Format,
flags: DecodeFlags
) -> Result<(), Error>
Decodes the PNG file and writes the image to out
. The image is converted from any PNG format to the
destination format out_format
. Interlaced images are deinterlaced and 16-bit
images are converted to
host-endian.
The out
buffer must have a length greater or equal to the size returned by decoded_image_size
with
the same out_format
.
If the SPNG_DECODE_PROGRESSIVE
flag is set, the context will be initialied with out_format
for
progressive decoding. The image is not immediately decoded and the out
buffer is ignored.
The SPNG_DECODE_TRNS
flag is ignored if the PNG has an alpha channel or does not contain a TRNS
chunk. It is also ignored for gray 1/2/4
-bit images.
The function may only be called once per context.
Decodes and deinterlaces a scanline to out
.
This function requires the decoder to be initialized by calling decode_image
with the
SPNG_DECODE_PROGRESSIVE
flag set.
The widest scanline is the decoded image size divided by ihdr.height
.
For the last scanline and subsequent calls the return value is SPNG_EOI
.
If the image is not interlaced this function’s behavior is identical to decode_scanline
.
Decodes a scanline to out
.
This function requires the decoder to be initialized by calling decode_image
with the
SPNG_DECODE_PROGRESSIVE
flag set.
The widest scanline is the decoded image size divided by ihdr.height
.
For the last scanline and subsequent calls the return value is SPNG_EOI
.
Set the input png
stream reader. The input buffer or stream may only be set once per context.