Question
Java Programming 1. Create a program wich takes in two RGB values and applies special function to them. We call these special functions blend modes.
Java Programming
1. Create a program wich takes in two RGB values and applies special function to them. We call these special functions blend modes.
a. Apply the darken function shouold compare each red, green, and blue value and return the lower of the two. Ex (255,0,90) -> (158,0,90)
b. Apply the lighen function to the RGB values. The function should compare each red, green and blue value and return the higher of the two. Ex: (255, 0, 90) lighen (148, 84, 181) -> (255, 84, 181)
c. Apply the multiply function to the two RGB values. It worls in the following way:
i. Convert eath rgb value into a decimal by deviding by 255. Ex (255,0,90) -> (1.00, 0.00, 0.35)
ii. Multiply the first color's red value to the second color's red value. Ex (1.00, 0.00, 0.35) * (0.58, 0.33, 0.71) -> (0.58, 0.00, 0.25).
iii. Convert the decimal back into an integer by multiplying by 255. Hint: use the int function. Ex: (0.58, 0.00, 0.25) -> (148,0.64)
d. Apply the screen functon to the RGB values. It works simillarly to the multiply function, except instead of multiplying two values (a*b), it uses the following: screen(a,b) = (1-a) * (1-b)
ex: (255,0,90) and (158,84,181) -> (1.00, 0.00, 0.35) and (0.58, 0.33, 0.71) (1.00), 0.00, 0,35) sreen (0.58), 0.33, 0.71) = (1.00, 0.33, 0.81)
-> R: 1 - (1 - 1.00) * (1-0.58) = 1.00
-> G: 1 - (1 - 0.00) * (1-0.33) = 0.33
-> B: 1 - (1-0.35) * 1-0.71) = 0.81
-> 1.00, 0.33, 0.81) -> (255,84,207)
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