Ejemplo n.º 1
0
        internal static LDRColour InterpolateRGB(LDRColour lDRColour1, LDRColour lDRColour2, int wc, int wcPrec)
        {
            LDRColour temp = new LDRColour();

            int[] weights;
            switch (wcPrec)
            {
            case 2:
                weights = AWeights2;
                break;

            case 3:
                weights = AWeights3;
                break;

            case 4:
                weights = AWeights4;
                break;

            default:
                return(temp);
            }
            temp.R = (lDRColour1.R * (BC67_WEIGHT_MAX - weights[wc]) + lDRColour2.R * weights[wc] + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT;
            temp.G = (lDRColour1.G * (BC67_WEIGHT_MAX - weights[wc]) + lDRColour2.G * weights[wc] + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT;
            temp.B = (lDRColour1.B * (BC67_WEIGHT_MAX - weights[wc]) + lDRColour2.B * weights[wc] + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT;
            return(temp);
        }
Ejemplo n.º 2
0
        internal static LDRColour Unquantise(LDRColour colour, LDRColour rGBPrecisionWithP)
        {
            LDRColour temp = new LDRColour
            {
                R = Unquantise(colour.R, rGBPrecisionWithP.R),
                G = Unquantise(colour.G, rGBPrecisionWithP.G),
                B = Unquantise(colour.B, rGBPrecisionWithP.B),
                A = rGBPrecisionWithP.A > 0 ? Unquantise(colour.A, rGBPrecisionWithP.A) : 255
            };

            return(temp);
        }
Ejemplo n.º 3
0
        internal static int InterpolateA(LDRColour lDRColour1, LDRColour lDRColour2, int wa, int waPrec)
        {
            int[] weights;
            switch (waPrec)
            {
            case 2:
                weights = AWeights2;
                break;

            case 3:
                weights = AWeights3;
                break;

            case 4:
                weights = AWeights4;
                break;

            default:
                return(0);
            }
            return((lDRColour1.A * (BC67_WEIGHT_MAX - weights[wa]) + lDRColour2.A * weights[wa] + BC67_WEIGHT_ROUND) >> BC67_WEIGHT_SHIFT);
        }