コード例 #1
0
        public                           Color[] GetPixels()
        {
            ushort c0 = (ushort)(high & 0xFFFF);
            ushort c1 = (ushort)((high >> 16) & 0xFFFF);

            Color32F[] colorTable = new Color32F[4];
            colorTable[0] = Color32F.From16BitColor(c0);
            colorTable[1] = Color32F.From16BitColor(c1);
            colorTable[2] = colorTable[0].GradientTwoOne(colorTable[1]);
            colorTable[3] = colorTable[1].GradientTwoOne(colorTable[0]);

            byte[] alphaTable = new byte[16];
            ulong  lut        = low;

            for (int i = 0; i < 16; i++)
            {
                alphaTable[i] = (byte)((lut & 0xF) * 0x11);
                lut         >>= 4;
            }

            Color[] t = new Color[16];
            lut = high >> 32;
            for (int i = 0; i < 16; i++)
            {
                int j = (int)(lut & 0x3);
                t[i]  = Color.FromArgb(alphaTable[j], colorTable[j].ToColor());
                lut >>= 2;
            }

            return(t);
        }
コード例 #2
0
        public                           Color[] GetPixels()
        {
            Color32F[] colorTable = new Color32F[4];
            ushort     c0         = (ushort)(texel & 0xFFFF);
            ushort     c1         = (ushort)((texel >> 16) & 0xFFFF);

            colorTable[0] = Color32F.From16BitColor(c0);
            colorTable[1] = Color32F.From16BitColor(c1);

            if (c0 > c1)
            {
                colorTable[2] = colorTable[0].Interpolate(colorTable[1], 3, 2);
                colorTable[3] = colorTable[1].Interpolate(colorTable[0], 3, 2);
            }
            else
            {
                colorTable[2] = colorTable[0].Interpolate(colorTable[1], 2, 1);
                colorTable[3] = Color32F.Zero;
            }

            Color[] pixels = new Color[16];
            uint    lut    = (uint)(texel >> 32);

            for (int i = 0; i < pixels.Length; i++)
            {
                pixels[i] = colorTable[(int)(lut & 0x3)].ToColor();
                lut     >>= 2;
            }

            return(pixels);
        }
コード例 #3
0
        public                           Color[] GetPixels()
        {
            ushort c0 = (ushort)(high & 0xFFFF);
            ushort c1 = (ushort)((high >> 16) & 0xFFFF);

            Color32F[] colorTable = new Color32F[4];
            colorTable[0] = Color32F.From16BitColor(c0);
            colorTable[1] = Color32F.From16BitColor(c1);
            colorTable[2] = colorTable[0].GradientTwoOne(colorTable[1]);
            colorTable[3] = colorTable[1].GradientTwoOne(colorTable[0]);

            byte[] alphaTable = new byte[16];
            alphaTable[0] = (byte)(low & 0xFF);
            alphaTable[1] = (byte)((low >> 8) & 0xFF);
            if (alphaTable[0] > alphaTable[1])
            {
                alphaTable[2] = (byte)((6 * alphaTable[0] + 1 * alphaTable[1]) / 7);
                alphaTable[3] = (byte)((5 * alphaTable[0] + 2 * alphaTable[1]) / 7);
                alphaTable[4] = (byte)((4 * alphaTable[0] + 3 * alphaTable[1]) / 7);
                alphaTable[5] = (byte)((3 * alphaTable[0] + 4 * alphaTable[1]) / 7);
                alphaTable[6] = (byte)((2 * alphaTable[0] + 5 * alphaTable[1]) / 7);
                alphaTable[7] = (byte)((1 * alphaTable[0] + 6 * alphaTable[1]) / 7);
            }
            else
            {
                alphaTable[2] = (byte)((4 * alphaTable[0] + 1 * alphaTable[1]) / 5);
                alphaTable[3] = (byte)((3 * alphaTable[0] + 2 * alphaTable[1]) / 5);
                alphaTable[4] = (byte)((2 * alphaTable[0] + 3 * alphaTable[1]) / 5);
                alphaTable[5] = (byte)((1 * alphaTable[0] + 4 * alphaTable[1]) / 5);
                alphaTable[6] = 0x0;
                alphaTable[7] = 0xFF;
            }

            Color[] t   = new Color[16];
            ulong   lut = high >> 32;

            for (int i = 0; i < 16; i++)
            {
                int j = (int)(lut & 0x3);
                t[i]  = Color.FromArgb(alphaTable[j], colorTable[j].ToColor());
                lut >>= 2;
            }

            return(t);
        }