Sunset Effect – Intro to Java Programming

I’ll show you a nifty photot that needs math function to work. We want to take any old photo and make it appear as if it happened at sunset. And the idea is simple. We’ll just add some extra red, like this. But there’s a potential problem. What if red is already 255 or close to it. Then if we ad 25 to it, then we’ll get a value that’s larger than 255 and that won’t work. So I want red to be red plus 25 but at most 255. And one of the math functions that we’ve just seen will solve this for you. I’ll even give you a hint. It’s either Math.max or Max.min. So go ahead and implement the redden method in the color class and then try out the effect.

Leave a Reply

Your email address will not be published. Required fields are marked *