Question: Need help manipulating ppm files based on the functions below: readPic - read the image into the structure (allocate space) rotate - rotate by 90
Need help manipulating ppm files based on the functions below:
readPic - read the image into the structure (allocate space)
#include #include #include //////////////////////////////////////////////////////////////////////////////////////////////// #ifndef RGB_STRUCT #define RGB_STRUCT typedef struct pixel { int red; // red value int green; // green value int blue; // blue value } Pixel; #endif //////////////////////////////////////////////////////////////////////////////////////////////// #ifndef PPM_STRUCT #define PPM_STRUCT typedef struct ppm { int rows; // number of rows int cols; // number of columns int colors; // number of colors Pixel **pixels; // the actual pixel data } ppmPic; #endif //////////////////////////////////////////////////////////////////////////////////////////////// ppmPic *readPic(char *); void writePic(ppmPic *, char *); ppmPic *rotateLeft(ppmPic *); ppmPic *rotateRight(ppmPic *); ppmPic *flipHorizontal(ppmPic *); ppmPic *flipVertical(ppmPic *); ppmPic *invert(ppmPic *); ppmPic *duplicate(ppmPic *); ////////////////////////////////////////////////////////////////////////////////////////////////
#include #include #include #include "ppn.h" int main (int argc, char The code below is found the files ppm.h and main.c **argv) { 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
Students Have Also Explored These Related Databases Questions!