Question: (20 points) Color in computer is often represented as a 3-tuple (R,G,B) such that R,G,B are each an integer ranging from 0 to 255 .

 (20 points) Color in computer is often represented as a 3-tuple

(20 points) Color in computer is often represented as a 3-tuple (R,G,B) such that R,G,B are each an integer ranging from 0 to 255 . The R value is the red component, the G value green component and B, the blue component. For example: (0,0,0) represents black and (255,255,255) represents white. We can use hexadecimal (base 16) to represent each color. Recall that the allowable "numerals" for base 16 are: H={0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}. Then since each component is a value between 0 and 255, we can use two hexadecimal numerals for each component. (This is because with two hexadecimal numerals, you can represent all integers between (00)16,2=0 and (FF)16,2=255. A hex color is an integer n that has a base 16 fixed-width 6 expansion: n=(r1r2g1g2b1b2)16,6 where (r1r2)16,2 is the red component, (g1g2)16,2, the green component, and (b1b2)16,2, the blue component. (a) What is the red, green, and blue values each in base 10 of the hex color: (3AA5BC)16,6 (b) What is the hex color that corresponds to the (R,G,B) values of (95,166,240) ? (c) A color is considered "gray" if the red, green and blue components are all equal. Often, we would like to "desaturate" a color by converting to a gray color. One way to do this is to calculate a gray value and repeat the value each for the red, green and blue components. A function to compute the gray value is described below: Consider the function G : - Domain: the set of all fixed width 6 hexadecimal integers. - Codomain: the set of all integers in the range 0 to 255. - Rule: for any input (r1r2g1g2b1b2)16,6, G((r1r2g1g2b1b2)16,6)=((r1r2)16+(g1g2)16+(b1b2)16)/3 i. Evaluate G((7DE538)16). (Show your work. It is your choice to have your answer in base 16 or base 10). ii. Convert the base 10 integer 5509223 into fixed width 6 hexadecimal and then compute the output of G on this number. (Please show your work.) iii. (for fair effort completeness) What happens if you input a gray color (a color that has equal red, green and blue components)? Is it what you expect to happen

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!