/// <summary> /// Converts the color to RGBW format. /// </summary> /// <param name="color">Color to convert</param> /// <returns>RGBW struct representing the color</returns> /// <remarks>This method uses the Saiko algorithm</remarks> public static RGBW ToRGBW(this Color color) { // First step convert the color to HSI color space HSI hsi = color.ToHSI(); // Second step convert to RGBW return(hsi.ToRGBW()); }
/// <summary> /// Converts a Color struct to an HSI struct. /// </summary> /// <param name="color">Color to convert</param> /// <returns>HSI struct representing the color</returns> public static HSI ToHSI(this Color color) { // Convert the RBG to HSI double h; double s; double i; RGBToHSI(color.R / 255.0, color.G / 255.0, color.B / 255.0, out h, out s, out i); // Create the HSI struct HSI hsi = new HSI(h, s, i); // Return the HSI struct return(hsi); }