This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Transitioning Colours Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Transitioning Colours" Watch "Transitioning Colours" New topic
Author

Transitioning Colours

Mikpo Siru
Ranch Hand

Joined: Apr 09, 2009
Posts: 54
Hi,

I have written a class that transitions from a starting colour to and ending colour. However there is one problem: the ending colour is always slightly off from what I specify. I've done my best to take care of rounding errors...any hints as to how I should proceed?

Thanks.

Mikpo Siru
Ranch Hand

Joined: Apr 09, 2009
Posts: 54
Just thought of a crude way around it: when colour transition loop finishes, force the final colour to be the given ending colour. However the discontinuity in colour is obvious. Other suggestions are welcome!
Mikpo Siru
Ranch Hand

Joined: Apr 09, 2009
Posts: 54
Fixed it by performing the step calculations in the loop.

 
Don't get me started about those stupid light bulbs.
 
subject: Transitioning Colours
 
Similar Threads
Method design problem
Is this "thread-safe"?
Enums
quadruple
Pixel Transparency