Question: This Program is done in C. include #include #include #include ppn.h int main(int argc, char **argv) i The code below is found the files ppm.h
This Program is done in C.
include #include #include #include "ppn.h" int main(int argc, char **argv) i The code below is found the files ppm.h and main.c These files should NOT be modified. You are to write ppm.c, which contains implementations for the eight functions defined in ppm.h (readPic, writePic, rotateLeft, rotateRight, flipVertical, flipHorizontal, invert and duplicate) if (argc ! 3) { printf ("Usage: -/a.out ppm-file ") return 1; printf("reading the original image. .. "); origPicreadPic (argv [2]); if (origPic NULL) be opened ", argv[2]); printf ("File return 2; %s cannot # include #include #include if (stramp (argvi], "rotateLeft")0) #ifndef RGB STRUCT #define RGB STRUCT typedef struct pixel [ printf("rotating the image to the left. . . ") newPic = rotateLeft (origPic) ; writePic (newPic, argv[2]); else "rotateRight") 0) { if printf("rotating the image to the right. .. " newPic = rotateRight (origPic) ; writePic (newPic, argv[2]) (strcmp (argv [1], int red; // red value int green; // green value int blue // blue value - | Pixe1; fendi f else "flipvertical") 0) { if printf ("flipping the image vertically.. . "); newPic = flipvertical (origPic) ; writePic (newPic, argv [2]); (strcmp (argv [1], = #ifndef PPM STRUCT #define PPM STRUCT typedef struct ppm int rows; int cols; int colors; else if printf("flipping the image horizontally. .. " newPc = flipHorizontal (origPic) ; writePic (newPic, argv[2]) (strcmp (argv [1], "flipHorizontal") 0) { // number of rows // number of columns // number of colors - Pixel **pixels; // the actual pixel data ppmPic; #endif else if (stromp (argv [1], "invert") 0) printf ("inverting the image. . . "); newPic invert (origPio); writePic (newPic, argv[2]); PpmPic *readPic (char *); void writePic (ppmPic *, char *); ppmPic *rotateLeft (ppmPic *): ppmPic *rotateRight (ppmPic*) ppmPic *flipHorizontal (ppmPic *); ppmPic *flipVertical (ppmPic *); ppmPic *invert (ppmPic *); else if (stremp (argv[1], "duplicate")0) printf ("duplicating the image newPic -duplicate (origPic); writePic (newPic, argv[2]) . ") else ic *duplicate (ppmPic *); printf ("s is an invalid option. ", argv1] return 0 include #include #include #include "ppn.h" int main(int argc, char **argv) i The code below is found the files ppm.h and main.c These files should NOT be modified. You are to write ppm.c, which contains implementations for the eight functions defined in ppm.h (readPic, writePic, rotateLeft, rotateRight, flipVertical, flipHorizontal, invert and duplicate) if (argc ! 3) { printf ("Usage: -/a.out ppm-file ") return 1; printf("reading the original image. .. "); origPicreadPic (argv [2]); if (origPic NULL) be opened ", argv[2]); printf ("File return 2; %s cannot # include #include #include if (stramp (argvi], "rotateLeft")0) #ifndef RGB STRUCT #define RGB STRUCT typedef struct pixel [ printf("rotating the image to the left. . . ") newPic = rotateLeft (origPic) ; writePic (newPic, argv[2]); else "rotateRight") 0) { if printf("rotating the image to the right. .. " newPic = rotateRight (origPic) ; writePic (newPic, argv[2]) (strcmp (argv [1], int red; // red value int green; // green value int blue // blue value - | Pixe1; fendi f else "flipvertical") 0) { if printf ("flipping the image vertically.. . "); newPic = flipvertical (origPic) ; writePic (newPic, argv [2]); (strcmp (argv [1], = #ifndef PPM STRUCT #define PPM STRUCT typedef struct ppm int rows; int cols; int colors; else if printf("flipping the image horizontally. .. " newPc = flipHorizontal (origPic) ; writePic (newPic, argv[2]) (strcmp (argv [1], "flipHorizontal") 0) { // number of rows // number of columns // number of colors - Pixel **pixels; // the actual pixel data ppmPic; #endif else if (stromp (argv [1], "invert") 0) printf ("inverting the image. . . "); newPic invert (origPio); writePic (newPic, argv[2]); PpmPic *readPic (char *); void writePic (ppmPic *, char *); ppmPic *rotateLeft (ppmPic *): ppmPic *rotateRight (ppmPic*) ppmPic *flipHorizontal (ppmPic *); ppmPic *flipVertical (ppmPic *); ppmPic *invert (ppmPic *); else if (stremp (argv[1], "duplicate")0) printf ("duplicating the image newPic -duplicate (origPic); writePic (newPic, argv[2]) . ") else ic *duplicate (ppmPic *); printf ("s is an invalid option. ", argv1] return 0