Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (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
4. (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= (11T29192b162) 16,6 where (112) 16,2 is the red component, (9192)16,2, the green component, and (b1b2)16,2, the blue com- ponent. (a) What is the red, green, and blue values each in base 10 of the hex color: (53D AC7)16,6 (b) What is the hex color that corresponds to the (R,G,B) values of (150, 200, 250)? (c) Convert the base 10) integer 9999999 into hex color (a base 16 number with a fixed-width of 6.) (d) 12-bit color was used in the 80s on a few different computers. It is an integer n that has a base 16 fixed-uridth 3 expansion: n= (rgb) 16,3- (Recall that for this problem, H = {0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F}.) Consider the function "color convert": CC : a 3 Domain: the set of all fixed width 6 hexadecimal integers. Codomain: the set of all fixed width 3 hexadecimal integers. Rule: for any input (r1r29192b162) 16,6, CC((711291926162) 16,6) = (r19161) 16,3 i. Evaluate CC((A43BBB)16,3). (You do not need to show your work.) ii. What is the output of the function CC if the input is the hex color that corresponds to the (base 10) integer 502393? (Please show your work.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started