/// <summary>
 /// Creates a new instance of a whitepoint
 /// </summary>
 /// <param name="Name">The name of the whitepoint</param>
 public Whitepoint(WhitepointName Name)
 {
     this.Name = Name;
     DefVal = GetXYZValues(Name);
     DefCh = GetChromaticityValues(Name);
     if (DefVal == null || DefCh == null) this.Name = WhitepointName.Custom;
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new instance of a CIE L*a*b* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="a">a-value (green/magenta) (-128 - 127)</param>
 /// <param name="b">b-value (blue/yellow) (-128 - 127)</param>
 public BColorLab(WhitepointName ReferenceWhite, byte L, sbyte a, sbyte b)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L  = L;
     this.a  = a;
     this.b  = b;
 }
Beispiel #3
0
 /// <summary>
 /// Creates a new instance of a CIE L*u*v* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="u">u-value (red/green) (-128 - 127)</param>
 /// <param name="v">v-value (blue/yellow) (-128 - 127)</param>
 public BColorLuv(WhitepointName ReferenceWhite, byte L, sbyte u, sbyte v)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L  = L;
     this.u  = u;
     this.v  = v;
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new instance of a CIE XYZ Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="X">X-value (0 - 255)</param>
 /// <param name="Y">Y-value (0 - 255)</param>
 /// <param name="Z">Z-value (0 - 255)</param>
 public BColorXYZ(WhitepointName ReferenceWhite, byte X, byte Y, byte Z)
     : base()
 {
     this.wp = ReferenceWhite;
     this.X  = X;
     this.Y  = Y;
     this.Z  = Z;
 }
Beispiel #5
0
 /// <summary>
 /// Creates a new instance of a CIE LCH Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="C">Chroma</param>
 /// <param name="H">Hue (0 - 360)</param>
 public UColorLCH(WhitepointName ReferenceWhite, ushort L, ushort C, ushort H)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L  = L;
     this.C  = C;
     this.H  = H;
 }
 /// <summary>
 /// Creates a new instance of a CIE L*a*b* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="a">a-value (green/magenta) (-32768 - 32767)</param>
 /// <param name="b">b-value (blue/yellow) (-32768 - 32767)</param>
 public UColorLab(WhitepointName ReferenceWhite, ushort L, short a, short b)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L = L;
     this.a = a;
     this.b = b;
 }
Beispiel #7
0
 /// <summary>
 /// Creates a new instance of a CIE Yxy Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="Y">Y-value (0 - 255)</param>
 /// <param name="x">x-value (-128 - 127)</param>
 /// <param name="y">y-value (-128 - 127)</param>
 public BColorYxy(WhitepointName ReferenceWhite, byte Y, sbyte x, sbyte y)
     : base()
 {
     this.wp = ReferenceWhite;
     this.Y  = Y;
     this.x  = x;
     this.y  = y;
 }
 /// <summary>
 /// Creates a new instance of a CIE LCH Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="C">Chroma (0 - 255)</param>
 /// <param name="H">Hue (0 - 255)</param>
 public BColorLCH(WhitepointName ReferenceWhite, byte L, byte C, byte H)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L = L;
     this.C = C;
     this.H = H;
 }
 /// <summary>
 /// Creates a new instance of a CIE L*a*b* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="a">a-value (green/magenta) (-128 - 127)</param>
 /// <param name="b">b-value (blue/yellow) (-128 - 127)</param>
 public BColorLab(WhitepointName ReferenceWhite, byte L, sbyte a, sbyte b)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L = L;
     this.a = a;
     this.b = b;
 }
Beispiel #10
0
 /// <summary>
 /// Creates a new instance of a CIE L*u*v* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="u">u-value (red/green) (-32768 - 32767)</param>
 /// <param name="v">v-value (blue/yellow) (-32768 - 32767)</param>
 public UColorLuv(WhitepointName ReferenceWhite, ushort L, short u, short v)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L  = L;
     this.u  = u;
     this.v  = v;
 }
Beispiel #11
0
 /// <summary>
 /// Creates a new instance of a CIE LCH Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="C">Chroma (0 - 255)</param>
 /// <param name="H">Hue (0 - 255)</param>
 public BColorLCH(WhitepointName ReferenceWhite, byte L, byte C, byte H)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L  = L;
     this.C  = C;
     this.H  = H;
 }
Beispiel #12
0
 /// <summary>
 /// Creates a new instance of a CIE Yxy Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="Y">Y-value (0 - 65535)</param>
 /// <param name="x">x-value (-32768 - 32767)</param>
 /// <param name="y">y-value (-32768 - 32767)</param>
 public UColorYxy(WhitepointName ReferenceWhite, ushort Y, short x, short y)
     : base()
 {
     this.wp = ReferenceWhite;
     this.Y  = Y;
     this.x  = x;
     this.y  = y;
 }
Beispiel #13
0
 /// <summary>
 /// Creates a new instance of a CIE L*a*b* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="a">a-value (green/magenta) (-32768 - 32767)</param>
 /// <param name="b">b-value (blue/yellow) (-32768 - 32767)</param>
 public UColorLab(WhitepointName ReferenceWhite, ushort L, short a, short b)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L  = L;
     this.a  = a;
     this.b  = b;
 }
Beispiel #14
0
 /// <summary>
 /// Creates a new instance of a CIE XYZ Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="X">X-value (0 - 65535)</param>
 /// <param name="Y">Y-value (0 - 65535)</param>
 /// <param name="Z">Z-value (0 - 65535)</param>
 public UColorXYZ(WhitepointName ReferenceWhite, ushort X, ushort Y, ushort Z)
     : base()
 {
     this.wp = ReferenceWhite;
     this.X  = X;
     this.Y  = Y;
     this.Z  = Z;
 }
Beispiel #15
0
 /// <summary>
 /// Creates a new instance of a CIE LCH Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="C">Chroma</param>
 /// <param name="H">Hue (0 - 360)</param>
 public UColorLCH(WhitepointName ReferenceWhite, ushort L, ushort C, ushort H)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L = L;
     this.C = C;
     this.H = H;
 }
Beispiel #16
0
 /// <summary>
 /// Creates a new instance of a whitepoint
 /// </summary>
 /// <param name="Name">The name of the whitepoint</param>
 public Whitepoint(WhitepointName Name)
 {
     this.Name = Name;
     DefVal    = GetXYZValues(Name);
     DefCh     = GetChromaticityValues(Name);
     if (DefVal == null || DefCh == null)
     {
         this.Name = WhitepointName.Custom;
     }
 }
Beispiel #17
0
        /// <summary>
        /// The position of a whitepoint in chromaticity coordinates
        /// </summary>
        /// <param name="whitepoint">The name of the whitepoint</param>
        /// <returns>The chromaticity coordinates from the whitepoint</returns>
        public static double[] GetChromaticityValues(WhitepointName whitepoint)
        {
            switch (whitepoint)
            {
            case WhitepointName.A:
                return(Ch_A);

            case WhitepointName.B:
                return(Ch_B);

            case WhitepointName.C:
                return(Ch_C);

            case WhitepointName.D50:
                return(Ch_D50);

            case WhitepointName.D55:
                return(Ch_D55);

            case WhitepointName.D65:
                return(Ch_D65);

            case WhitepointName.D75:
                return(Ch_D75);

            case WhitepointName.E:
                return(Ch_E);

            case WhitepointName.F2:
                return(Ch_F2);

            case WhitepointName.F7:
                return(Ch_F7);

            case WhitepointName.F11:
                return(Ch_F11);

            default:
                return(null);
            }
        }
 /// <summary>
 /// Converts a color to a Lab color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="RefWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public ColorLab ToLab(Color InColor, WhitepointName RefWhite)
 {
     if (RefWhite != WhitepointName.Custom) OutReferenceWhite = WhitepointArr[(int)RefWhite];
     else OutReferenceWhite = ReferenceWhite;
     OutputModel = ColorModel.CIELab;
     SetInputColor(InColor);
     varArr = Do();
     return new ColorLab(OutReferenceWhite, varArr[0], varArr[1], varArr[2]);
 }
 /// <summary>
 /// Converts a color to a Yxy color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="ReferenceWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public BColorYxy ToYxy(BColor InColor, WhitepointName ReferenceWhite)
 {
     varArr = Do(InColor, ColorModel.CIEYxy, ReferenceWhite);
     return new BColorYxy(OutReferenceWhite.Name, (byte)(varArr[0] * 255), (sbyte)varArr[1], (sbyte)varArr[2]);
 }
Beispiel #20
0
 /// <summary>
 /// Creates a new instance of a CIE LCHuv Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="C">Chroma (0 - 255)</param>
 /// <param name="H">Hue (0 - 255)</param>
 public BColorLCHuv(WhitepointName ReferenceWhite, byte L, byte C, byte H)
     : base(ReferenceWhite, L, C, H)
 {
 }
 /// <summary>
 /// Converts a color to a Lab color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="ReferenceWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public UColorLab ToLab(UColor InColor, WhitepointName ReferenceWhite)
 {
     varArr = Do(InColor, ColorModel.CIELab, ReferenceWhite);
     return new UColorLab(OutReferenceWhite.Name, (ushort)(varArr[0] * 655.35), (short)varArr[1], (short)varArr[2]);
 }
Beispiel #22
0
 /// <summary>
 /// Creates a new instance of a CIE LCH Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public UColorLCH(WhitepointName ReferenceWhite)
     : this(ReferenceWhite, 0, 0, 0)
 {
 }
Beispiel #23
0
 /// <summary>
 /// Creates a new instance of a CIE LCHab Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public UColorLCHab(WhitepointName ReferenceWhite)
     : base(ReferenceWhite, 0, 0, 0)
 {
 }
Beispiel #24
0
 /// <summary>
 /// Creates a new instance of a CIE LCHab Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public BColorLCHab(WhitepointName ReferenceWhite)
     : base(ReferenceWhite, 0, 0, 0)
 {
 }
Beispiel #25
0
 /// <summary>
 /// Creates a new instance of a CIE LCHuv Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="C">Chroma (0 - 255)</param>
 /// <param name="H">Hue (0 - 255)</param>
 public BColorLCHuv(WhitepointName ReferenceWhite, byte L, byte C, byte H)
     : base(ReferenceWhite, L, C, H)
 {
 }
 /// <summary>
 /// Converts a color to a gray color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="ReferenceWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public BColorGray ToGray(BColor InColor, WhitepointName ReferenceWhite)
 {
     varArr = Do(InColor, ColorModel.Gray, ReferenceWhite);
     return new BColorGray(OutReferenceWhite.Name, (byte)(varArr[0] * 255));
 }
Beispiel #27
0
 /// <summary>
 /// Creates a new instance of a CIE XYZ Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="X">X-value (0 - 255)</param>
 /// <param name="Y">Y-value (0 - 255)</param>
 /// <param name="Z">Z-value (0 - 255)</param>
 public BColorXYZ(WhitepointName ReferenceWhite, byte X, byte Y, byte Z)
     : base()
 {
     this.wp = ReferenceWhite;
     this.X = X;
     this.Y = Y;
     this.Z = Z;
 }
Beispiel #28
0
 /// <summary>
 /// Creates a new instance of a CIE LCHuv Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="C">Chroma</param>
 /// <param name="H">Hue (0 - 360)</param>
 public UColorLCHuv(WhitepointName ReferenceWhite, ushort L, ushort C, ushort H)
     : base(ReferenceWhite, L, C, H)
 {
 }
Beispiel #29
0
 /// <summary>
 /// Creates a new instance of a CIE L*a*b* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public BColorLab(WhitepointName ReferenceWhite)
     : this(ReferenceWhite, 0, 0, 0)
 {
 }
Beispiel #30
0
 /// <summary>
 /// Creates a new instance of a CIE L*u*v* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 255)</param>
 /// <param name="u">u-value (red/green) (-128 - 127)</param>
 /// <param name="v">v-value (blue/yellow) (-128 - 127)</param>
 public BColorLuv(WhitepointName ReferenceWhite, byte L, sbyte u, sbyte v)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L = L;
     this.u = u;
     this.v = v;
 }
 /// <summary>
 /// Converts a color to a Lab color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="ReferenceWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public BColorLab ToLab(BColor InColor, WhitepointName ReferenceWhite)
 {
     varArr = Do(InColor, ColorModel.CIELab, ReferenceWhite);
     return new BColorLab(OutReferenceWhite.Name, (byte)(varArr[0] * 2.55), (sbyte)varArr[1], (sbyte)varArr[2]);
 }
Beispiel #32
0
 /// <summary>
 /// Creates a new instance of a CIE Yxy Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="Y">Y-value (0 - 255)</param>
 /// <param name="x">x-value (-128 - 127)</param>
 /// <param name="y">y-value (-128 - 127)</param>
 public BColorYxy(WhitepointName ReferenceWhite, byte Y, sbyte x, sbyte y)
     : base()
 {
     this.wp = ReferenceWhite;
     this.Y = Y;
     this.x = x;
     this.y = y;
 }
Beispiel #33
0
 /// <summary>
 /// Creates a new instance of a CIE L*u*v* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="u">u-value (red/green) (-32768 - 32767)</param>
 /// <param name="v">v-value (blue/yellow) (-32768 - 32767)</param>
 public UColorLuv(WhitepointName ReferenceWhite, ushort L, short u, short v)
     : base()
 {
     this.wp = ReferenceWhite;
     this.L = L;
     this.u = u;
     this.v = v;
 }
Beispiel #34
0
 /// <summary>
 /// Creates a new instance of a CIE XYZ Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="X">X-value (0 - 65535)</param>
 /// <param name="Y">Y-value (0 - 65535)</param>
 /// <param name="Z">Z-value (0 - 65535)</param>
 public UColorXYZ(WhitepointName ReferenceWhite, ushort X, ushort Y, ushort Z)
     : base()
 {
     this.wp = ReferenceWhite;
     this.X = X;
     this.Y = Y;
     this.Z = Z;
 }
Beispiel #35
0
 /// <summary>
 /// Creates a new instance of a CIE Yxy Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="Y">Y-value (0 - 65535)</param>
 /// <param name="x">x-value (-32768 - 32767)</param>
 /// <param name="y">y-value (-32768 - 32767)</param>
 public UColorYxy(WhitepointName ReferenceWhite, ushort Y, short x, short y)
     : base()
 {
     this.wp = ReferenceWhite;
     this.Y = Y;
     this.x = x;
     this.y = y;
 }
Beispiel #36
0
 /// <summary>
 /// Creates a new instance of a CIE LCHuv Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public BColorLCHuv(WhitepointName ReferenceWhite)
     : base(ReferenceWhite, 0, 0, 0)
 {
 }
Beispiel #37
0
 /// <summary>
 /// Creates a new instance of a gray Color
 /// </summary>
 /// <param name="G">The value of the gray (0 - 65535)</param>
 /// <param name="ReferenceWhite">The reference white</param>
 public UColorGray(WhitepointName ReferenceWhite, ushort G)
     : base()
 {
     this.G  = G;
     this.wp = ReferenceWhite;
 }
        /// <summary>
        /// The position of a whitepoint in XYZ values
        /// </summary>
        /// <param name="whitepoint">The name of the whitepoint</param>
        /// <returns>The XYZ values from the whitepoint</returns>
        public static double[] GetXYZValues(WhitepointName whitepoint)
        {
            switch (whitepoint)
            {
                case WhitepointName.A:
                    return XYZ_A;
                case WhitepointName.B:
                    return XYZ_B;
                case WhitepointName.C:
                    return XYZ_C;
                case WhitepointName.D50:
                    return XYZ_D50;
                case WhitepointName.D55:
                    return XYZ_D55;
                case WhitepointName.D65:
                    return XYZ_D65;
                case WhitepointName.D75:
                    return XYZ_D75;
                case WhitepointName.E:
                    return XYZ_E;
                case WhitepointName.F2:
                    return XYZ_F2;
                case WhitepointName.F7:
                    return XYZ_F7;
                case WhitepointName.F11:
                    return XYZ_F11;

                default:
                    return null;
            }
        }
Beispiel #39
0
 /// <summary>
 /// Creates a new instance of a CIE LCHuv Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 /// <param name="L">Lightness (0 - 65535)</param>
 /// <param name="C">Chroma</param>
 /// <param name="H">Hue (0 - 360)</param>
 public UColorLCHuv(WhitepointName ReferenceWhite, ushort L, ushort C, ushort H)
     : base(ReferenceWhite, L, C, H)
 {
 }
Beispiel #40
0
 /// <summary>
 /// Creates a new instance of a gray Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public UColorGray(WhitepointName ReferenceWhite)
     : this(ReferenceWhite, 0)
 {
 }
 /// <summary>
 /// Converts a color to a gray color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="ReferenceWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public UColorGray ToGray(UColor InColor, WhitepointName ReferenceWhite)
 {
     varArr = Do(InColor, ColorModel.Gray, ReferenceWhite);
     return new UColorGray(OutReferenceWhite.Name, (ushort)(varArr[0] * 65535));
 }
Beispiel #42
0
 /// <summary>
 /// Creates a new instance of a CIE LCHuv Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public UColorLCHuv(WhitepointName ReferenceWhite)
     : base(ReferenceWhite, 0, 0, 0)
 {
 }
Beispiel #43
0
 /// <summary>
 /// Creates a new instance of a CIE L*u*v* Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public BColorLuv(WhitepointName ReferenceWhite)
     : this(ReferenceWhite, 0, 0, 0)
 {
 }
Beispiel #44
0
 /// <summary>
 /// Creates a new instance of a CIE LCH Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public UColorLCH(WhitepointName ReferenceWhite)
     : this(ReferenceWhite, 0, 0, 0)
 {
 }
 /// <summary>
 /// Converts from one colorspace to another
 /// </summary>
 /// <param name="inColor">Input color</param>
 /// <param name="outModel">Output colormodel</param>
 /// <param name="RefWhite">The reference white the output should have</param>
 /// <returns>Returns a color with the converted values from the input</returns>
 internal double[] Do(UColor inColor, ColorModel outModel, WhitepointName RefWhite)
 {
     if (RefWhite != WhitepointName.Custom) OutReferenceWhite = WhitepointArr[(int)RefWhite];
     else OutReferenceWhite = ReferenceWhite;
     OutputModel = outModel;
     RGBSpace = StandardColorspace;
     YCbCrSpace = StandardYCbCrSpace;
     SetInputColor(inColor);
     return Do();
 }
 /// <summary>
 /// Converts a color to a XYZ color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="ReferenceWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public UColorXYZ ToXYZ(UColor InColor, WhitepointName ReferenceWhite)
 {
     varArr = Do(InColor, ColorModel.CIEXYZ, ReferenceWhite);
     return new UColorXYZ(OutReferenceWhite.Name, (ushort)(varArr[0] * 65535), (ushort)(varArr[1] * 65535), (ushort)(varArr[2] * 65535));
 }
 /// <summary>
 /// Converts a color to a gray color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="RefWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public ColorGray ToGray(Color InColor, WhitepointName RefWhite)
 {
     if (RefWhite != WhitepointName.Custom) OutReferenceWhite = WhitepointArr[(int)RefWhite];
     else OutReferenceWhite = ReferenceWhite;
     OutputModel = ColorModel.Gray;
     SetInputColor(InColor);
     varArr = Do();
     return new ColorGray(OutReferenceWhite, varArr[0]);
 }
 /// <summary>
 /// Creates a new instance of a gray Color
 /// </summary>
 /// <param name="ReferenceWhite">The reference white</param>
 public BColorGray(WhitepointName ReferenceWhite)
     : this(ReferenceWhite, 0)
 {
 }
 /// <summary>
 /// Converts a color to a Yxy color
 /// </summary>
 /// <param name="InColor">The color to convert</param>
 /// <param name="ReferenceWhite">The reference white to be used for the converted color</param>
 /// <returns>The converted color</returns>
 public UColorYxy ToYxy(UColor InColor, WhitepointName ReferenceWhite)
 {
     varArr = Do(InColor, ColorModel.CIEYxy, ReferenceWhite);
     return new UColorYxy(OutReferenceWhite.Name, (ushort)(varArr[0] * 65535), (short)varArr[1], (short)varArr[2]);
 }
 /// <summary>
 /// Creates a new instance of a gray Color
 /// </summary>
 /// <param name="G">The value of the gray (0 - 255)</param>
 /// <param name="ReferenceWhite">The reference white</param>
 public BColorGray(WhitepointName ReferenceWhite, byte G)
     : base()
 {
     this.G = G;
     this.wp = ReferenceWhite;
 }
Beispiel #51
0
 /// <summary>
 /// Creates a new instance of a gray Color
 /// </summary>
 /// <param name="G">The value of the gray (0 - 255)</param>
 /// <param name="ReferenceWhite">The reference white</param>
 public BColorGray(WhitepointName ReferenceWhite, byte G)
     : base()
 {
     this.G  = G;
     this.wp = ReferenceWhite;
 }