Question: Write a C program to create a binary ppm file with 1000 by 1000 pixels. It uses five input colors to draw a picture. See

Write a C program to create a binary ppm file with 1000 by 1000 pixels. It uses five input colors to draw a picture. See sample runs. The input colors can be: red, green, blue, yellow, orange, cyan, magenta, ocean, violet. The corners of the central part should use the 250th and 750th row/column.

Restrictions on the file format:

no comment line after the file type specification width (number of columns) and height (number of rows) formatted in ASCII decimal in the second line, separated by a space maximal value of color components given in the third line Requirements on parallel execution: | The parent process will not wait for the child process to terminate before creating the next process. The processes will do the calculation in parallel. Add some sleep time to simulate larger calculation. The processes will write the data into the image file sequentially. This is coordinated by the parent using signals. You can only use signal for inter-process communication.

Other requirements: You are not allowed to use standard I/O library functions or graphics related libraries. The command line arguments include the following in order: (i) the name of the image file; (ii) color for center; (iii) color for top-left corner; (iv) color for top-right corner; (v) color for bottom-left corner; (vi) color for bottom-right corner. Advanced requirements (optional): The numbers of rows and columns of the image are not fixed numbers. They are also command line arguments. The number of child processes is not a fixed number. It is also a command line argument.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
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!