+struct image_io {
+ /* R - read_header input */
+ /* H - read_header output */
+ /* I - read_data input */
+ /* O - read_data output */
+ /* W - write input */
+
+ struct image *image; /* [ OW] - image data */
+ enum image_format format; /* [R W] - file format (IMAGE_FORMAT_x) */
+ struct fastbuf *fastbuf; /* [R W] - source/destination stream */
+ struct mempool *pool; /* [ I ] - parameter to image_new */
+ uns cols; /* [ HI ] - number of columns, parameter to image_new */
+ uns rows; /* [ HI ] - number of rows, parameter to image_new */
+ uns flags; /* [ HI ] - see enum image_io_flags */
+ uns jpeg_quality; /* [ W] - JPEG compression quality (1..100) */
+ uns number_of_colors; /* [ H ] - number of image colors */
+ struct color background_color; /* [ HI ] - background color, zero if undefined */
+ uns exif_size; /* [ H W] - EXIF size in bytes (zero if not present) */
+ byte *exif_data; /* [ H W] - EXIF data */
+
+ /* internals */
+ struct image_context *context;
+ struct mempool *internal_pool;
+ void *read_data;
+ void (*read_cancel)(struct image_io *io);
+};
+
+enum image_io_flags {
+ IMAGE_IO_IMAGE_FLAGS = 0xffff, /* [ HI ] - mask of parameters to image new, read_header fills IMAGE_CHANNELS_FORMAT */
+ IMAGE_IO_NEED_DESTROY = 0x10000, /* [ O ] - enables automatic call of image_destroy */
+ IMAGE_IO_HAS_PALETTE = 0x20000, /* [ H ] - true for image with indexed colors */
+ IMAGE_IO_USE_BACKGROUND = 0x40000, /* [ I ] - merge transparent pixels with background_color */
+ IMAGE_IO_WANT_EXIF = 0x80000, /* [R ] - read EXIF data if present */