hsv2rgb.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <string.h>
#include <unistd.h>
#include <ppm.h>
#include "hsv2rgb.proto"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 11 of file hsv2rgb.c.

References hsv2rgb_ppm(), PGM_ASC, PGM_RAW, PPM_ASC, ppm_handle_error(), PPM_OK, PPM_RAW, read_magic_no(), read_ppm(), and write_ppm().

00011                                  {
00012   
00013   FILE *ppm_file;
00014   PPM *im1, *im_rgb;
00015   enum file_types ppm_type;
00016   enum ppm_error the_error;
00017 
00018   ppm_file = stdin;
00019 
00020   switch(ppm_type = read_magic_no(ppm_file)) {
00021   case PGM_ASC: case PPM_ASC: case PGM_RAW: case PPM_RAW:
00022     if ((the_error = read_ppm(ppm_file, &im1, ppm_type)) != PPM_OK) {
00023       ppm_handle_error(the_error);
00024       exit(1);
00025     }
00026     break;
00027   default:
00028     fprintf(stderr, "Unrecognized file type.\n");
00029     break;  
00030   }
00031 
00032   if ((the_error = hsv2rgb_ppm(im1, &im_rgb)) != PPM_OK) {
00033     ppm_handle_error(the_error);
00034     exit(1);
00035   }
00036 
00037   if ((the_error = write_ppm(stdout, im_rgb, PPM_RAW)) != PPM_OK) {
00038     ppm_handle_error(the_error);
00039     exit(1);
00040   }
00041 
00042   exit(0);
00043 }


Generated on Tue Jan 6 00:30:52 2009 for Gift by  doxygen 1.5.6