Question: Please complete the following program ( s ) in C CODING LANGUAGE ( NOT C + + ) , also please specify which code goes

Please complete the following program(s) in C CODING LANGUAGE (NOT C++), also please specify which code goes in the colorsUtil.h file vs colorUtils.c:
In this hack you'll get some more practice writing functions that utilize pass-by-reference
(pointers), error handling and enumerated types. There are several different ways to
model colors including RGB and CMYK. RGB is generally used in displays and models
a color with three values in the range 0,255 corresponding to the red, green and blue
"contribution" to the color. For example, the triple (255,255,0) corresponds to a full
red and green (additive) value which results in yellow. CMYK or Cyan-Magenta-Yellow-
Black is a model used in printing where four colors of ink are combined to make various
colors. In this system, the four values are on the scale 0,1. Write functions to convert
between these models.
Write a function to convert from an RGB color model to CMYK. To convert to
CMYK, you first need to scale each integer value to the range 0,1 by simply
computing
r'=r255,g'=g255,b'=b255
and then using the following formulas:
k=1-max{r',g',b'}
c=(1-r'-k)(1-k)
m=(1-g'-k)(1-k)
y=(1-b'-k)(1-k)
Your function should have the following signature:
int rgbToCMYK(int r, int g, int b, double ** c, double **m, double **y, double **k)
Identify any and all error conditions and use the return value to indicate an error
code (0 for no error, non-zero value(s) for error conditions). Note that one edge
case is black, when (r,g,b)=(0,0,0) which would lead to a division by zero in the
formulas. The equivalent CMYK values are (0,0,0,1).
Write a function to convert from CMYK to RGB using the following formulas.
r=255*(1-c)*(1-k)
g=255*(1-m)*(1-k)
b=255*(1-y)*(1-k)
Results should be rounded. Your function should have the following signature:
int cmykToRGB(double c , double m , double y , double k , int **r, int **g, int **b)
Identify any and all error conditions and use the return value to indicate an error
code (0 for no error, non-zero value(s) for error conditions).
Place your prototypes and documentation in a header file named colorUtils.h
and your source in a file named colorUtils.c.Place your prototypes and documentation in a header file named colorUtils.h
and your source in a file named colorUtils.c.
Please complete the following program ( s ) in C

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 Programming Questions!