#ifndef SWIFT_IMAGE_PIXFMT_H
#define SWIFT_IMAGE_PIXFMT_H

#include <swift/maths.h>
#include <swift/stdlib.h>

#include <swift/image/api.h>

typedef struct swift_pixfmt_t swift_pixfmt_t;
typedef struct swift_pixfmt_ops_t swift_pixfmt_ops_t;

typedef void (* swift_read_pixel_fn_t)(swift_pixfmt_t *fmt, const void *data,
	swift_vec4u_t *colour);
typedef void (* swift_write_pixel_fn_t)(swift_pixfmt_t *fmt, void *data,
	swift_vec4u_t colour);

struct swift_pixfmt_t {
	swift_vec4u_t mask, shift, loss;
	swift_pixfmt_ops_t *ops;
	char *name;
	unsigned int bits_per_pixel, bytes_per_pixel;
};

struct swift_pixfmt_ops_t {
	swift_read_pixel_fn_t read_pixel;
	swift_write_pixel_fn_t write_pixel;
};

SWIFT_IMAGE_API swift_pixfmt_t *swift_get_pixfmt(const char *name);
SWIFT_IMAGE_API bool swift_init_pixfmts(void);
SWIFT_IMAGE_API void swift_term_pixfmts(void);

#endif /* SWIFT_IMAGE_PIXFMT_H */
