Category : Files from Magazines
Archive   : CUJ9202.ZIP
Filename : 1002036A

 
Output of file : 1002036A contained in archive : CUJ9202.ZIP

/* Listing 1 */

#include
#include

#define PAL_LEN 256

typedef struct
{
int red;
int grn;
int blu;
int num;
} pal;

pal palo[ PAL_LEN ]; /* original palette */
pal pals[ PAL_LEN ]; /* sorted palette */

/* index for the sorted palette */
int redindex[ PAL_LEN ];

/* prototypes */

int closest( int red, int green, int blue );
long dist( int red, int green, int blue, int num );
void sort_color();
int color_comp( const void *a, const void *b );