/** @file  psImageJpeg.h
 *
 * the functions to generate JPEG images from psImage 
 */

# ifndef PS_IMAGE_JPEG_H
# define PS_IMAGE_JPEG_H

typedef struct
{
    psString name;
    psVector *red;
    psVector *green;
    psVector *blue;
}
psImageJpegColormap;

# define PS_JPEG_RANGELIM(A)(PS_MAX(0,PS_MIN(255,(A))))

# define PS_JPEG_SCALEVALUE(VALUE,ZERO,SCALE)(PS_MAX(0,PS_MIN(255,(SCALE*(VALUE-ZERO)))))

// allocate a colormap (does not define the map values)
psImageJpegColormap *psImageJpegColormapAlloc ();

// set the colormap values using the supplied name
psImageJpegColormap *psImageJpegColormapSet (psImageJpegColormap *map, char *name);

// write out a JPEG file using the supplied image and colormap
// output goes to the specified filename
bool psImageJpeg (psImageJpegColormap *map, psImage *image, char *filename, float min, float max);

# endif /* PS_IMAGE_JPEG_H */
