/*<html><pre>*/
#ifndef V_IMAGE_H
#define V_IMAGE_H

#ifdef 	__cplusplus
extern	"C" {
#endif	/* __cplusplus */
	/*	Use this to set default alpha value for images without alpha
	 *	channel (alpha channel may present only in TGA images).
	 *	Returns old default alpha value.
	 */
	u8_t	V_GLOBAL		imgDefaultAlpha(u8_t new_alpha);
	/*	tgaLoad - load Targa image.
	 *	Input:
	 *		- name: name of input file;
	 *		- width, height: points to the width and height of image.
	 *	Output:
	 *		Returns malloc()'ed block of width*height*4 bytes, image
	 *		dimensions stored in 'width' and 'height'; in case of
	 *		error returns NULL ('width' and 'height' unchanged).
	 *	Notes.
	 *		1. 'width' and/or 'height' can be NULL.
	 *		2. Supported formats: TGA #2, #10.
	 */
	u8_p 	V_GLOBAL	tgaLoad(char *name,u32_t *width,u32_t *height);
	/*	tgaSave: saves RGBA (32-bit) targa image.
	 *	Input:
	 *		- name: image file name;
	 *		- width, height: dimensions of image;
	 *		- pixels: block of width*height*4 bytes.
	 *	Output: true if no error, false otherwise.
	 */
	vboolean	V_GLOBAL	tgaSave(char *name,u32_t width,u32_t height,
		u8_t *pixels);
	/*	tgaSaveEx: saves either RGB or RGBA (32-bit) targa image.
	 *	Input:
	 *		- save_alpha: if true, saves RGBA image; if false,
	 *			behaves like tgaSave().
	 *	Output: true if no error, false otherwise.
	 */
	vboolean	V_GLOBAL	tgaSaveEx(char *name,
		u32_t width,u32_t height,u8_t *pixels,vboolean save_alpha);
	/*	jpgLoad - load JPEG image.
	 *	Input, Output: see above.
	 *	NOTE. Currently no saving routine for JPEG (libv utilizes only
	 *	decompression size of libjpeg - about 100k of binaries).
	 */
	u8_p 	V_GLOBAL	jpgLoad(char *name,u32_t *width,u32_t *height);
	/*	bmpLoad - load Windows bitmap.
	 *	Input:
	 *		- name: name of input file;
	 *		- width, height: points to the width and height of image.
	 *	Output:
	 *		Returns malloc()'ed block of width*height*4 bytes, image
	 *		dimensions stored in 'width' and 'height'; in case of
	 *		error returns NULL ('width' and 'height' unchanged).
	 *	Notes.
	 *		1. 'width' and 'height' can be NULL.
	 *		Supported formats: RGB bitmap, paletted (256-color) bitmap.
	 */
	u8_p	V_GLOBAL	bmpLoad(char *name,u32_t *width,u32_t *height);
	/*	bmpSave: saves RGB (24-bit) Windows bitmap image.
	 *	Input:
	 *		- name: image file name or "//./clipboard";
	 *		- width, height: dimensions of image;
	 *		- pixels: block of width*height*4 bytes.
	 *	Output: true if no error, false otherwise.
	 */
	vboolean	V_GLOBAL	bmpSave(char *name,u32_t width,u32_t height,
		u8_t *pixels);
	/*	bmpSaveEx(): saves RGB image of resolution (1000*width)/mmWidth
	 *	by (1000*height) / mmHeight pels per meter.
	 *	Input:
	 *		- name: image file name or "//./clipboard";
	 *		- mmWidth: width of image in millimeters;
	 *		- mmHeight: height of image in millimeters.
	 *	Output: true if no error, false otherwise.
	 */
	vboolean	V_GLOBAL	bmpSaveEx(char *name,u32_t width,u32_t height,
		u8_t *pixels,u32_t mmWidth,u32_t mmHeight);
	/*	Utility function for bmpSaveEx(): calculates size in millimeters
	 *	by given picture size and device resolution in DPI */
	u32_t		V_GLOBAL	bmpMMFromPixels(u32_t num_pixels,
		u32_t device_dpi);
	/*	Scales input image to halfsize; returns memAlloc()'ed block; if
	 *	'keepon' than original block NOT memFree()'d */
	u8_p	V_GLOBAL	imgDownsample(u8_t *src,u32_t width,u32_t height,vboolean keepon);
#ifdef __cplusplus
}
#endif	/* __cplusplus */

#endif
/*</pre></html>*/
/*EOF*/
