MapSuiteGisEditor/GisEditorPluginCore/Shares/UIs/Controls/Utils/ColorConverter.cs
/// <summary>
/// Convert from YCbCr to RGB color space.
/// </summary>
/// 
/// <param name="ycbcr">Source color in <b>YCbCr</b> color space.</param>
/// <param name="rgb">Destination color in <b>RGB</b> color spacs.</param>
/// 
Convert from YCbCr to RGB color space.
Convert from YCbCr to RGB color space .
public static void YCbCr2RGB(YCbCr ycbcr, RGB rgb)
        {
            double r = Math.Max(0.0, Math.Min(1.0, ycbcr.Y + 0.0000 * ycbcr.Cb + 1.4022 * ycbcr.Cr));
            double g = Math.Max(0.0, Math.Min(1.0, ycbcr.Y - 0.3456 * ycbcr.Cb - 0.7145 * ycbcr.Cr));
            double b = Math.Max(0.0, Math.Min(1.0, ycbcr.Y + 1.7710 * ycbcr.Cb + 0.0000 * ycbcr.Cr));
            rgb.Red = (byte)(r * 255);
            rgb.Green = (byte)(g * 255);
            rgb.Blue = (byte)(b * 255);
        }
public static void YCbCr2RGB ( YCbCr ycbcr , RGB rgb ) { double r = Math . Max ( 0.0 , Math . Min ( 1.0 , ycbcr . Y + 0.0000 * ycbcr . Cb + 1.4022 * ycbcr . Cr ) ) ; double g = Math . Max ( 0.0 , Math . Min ( 1.0 , ycbcr . Y - 0.3456 * ycbcr . Cb - 0.7145 * ycbcr . Cr ) ) ; double b = Math . Max ( 0.0 , Math . Min ( 1.0 , ycbcr . Y + 1.7710 * ycbcr . Cb + 0.0000 * ycbcr . Cr ) ) ; rgb . Red = ( byte ) ( r * 255 ) ; rgb . Green = ( byte ) ( g * 255 ) ; rgb . Blue = ( byte ) ( b * 255 ) ; }
Convert from YCbCr to RGB color space.
Convert from YCbCr to RGB color space .
// don't warry about zeros. compiler will remove them
ycbcr
YCbCr
Source color in YCbCr
Source color in YCbCr
rgb
RGB
Destination color in RGB
Destination color in RGB