예제 #1
0
        public TrustXyValue(long value)
        {
            var bytes = new byte[4];

            bytes[0] = (byte)(value & 0xFFL);
            bytes[1] = (byte)(value >> 8 & 0xFFL);
            bytes[2] = (byte)(value >> 16 & 0xFFL);
            bytes[3] = (byte)(value >> 24 & 0xFFL);
            const float x  = 1.0f;
            var         y  = (bytes[2] | (bytes[3] << 8)) / ushort.MaxValue;
            var         y2 = (bytes[0] | (bytes[1] << 8)) / ushort.MaxValue;

            _color = new TrustColorYxy(x, y, y2);
        }
예제 #2
0
        public TrustColorYxy ToYxy()
        {
            if (X == 0.0f && Y == 0.0f && Z == 0.0f)
            {
                return(new TrustColorYxy(1.0F, 0.3127F, 0.329F));
            }
            var yxy = new TrustColorYxy();

            yxy.Y = Y;
            var f = X;

            yxy.X  = f / (Y + f + Z);
            f      = Y;
            yxy.Y2 = f / (X + f + Z);
            return(yxy);
        }
예제 #3
0
 public TrustXyValue(TrustColorYxy color)
 {
     _color = color;
 }