虽然这个代码是用Java写的而不是C++,但是它非常易于重复使用。在这个页面上寻找RGBtoHSB方法: http://www.docjar.com/html/api/java/awt/Color.java.html