示例#1
0
 public INTColor SignExtend(LDRColorA Prec)
 {
     r = SIGN_EXTEND(r, (int)(Prec.r));
     g = SIGN_EXTEND(g, (int)(Prec.g));
     b = SIGN_EXTEND(b, (int)(Prec.b));
     return(this);
 }
示例#2
0
        public static void TransformInverse(INTEndPntPair[] aEndPts, LDRColorA Prec, bool bSigned)
        {
            INTColor WrapMask = new INTColor((1 << Prec.r) - 1, (1 << Prec.g) - 1, (1 << Prec.b) - 1);

            aEndPts[0].B += aEndPts[0].A; aEndPts[0].B &= WrapMask;
            aEndPts[1].A += aEndPts[0].A; aEndPts[1].A &= WrapMask;
            aEndPts[1].B += aEndPts[0].A; aEndPts[1].B &= WrapMask;
            if (bSigned)
            {
                aEndPts[0].B.SignExtend(Prec);
                aEndPts[1].A.SignExtend(Prec);
                aEndPts[1].B.SignExtend(Prec);
            }
        }
示例#3
0
        public static void InterpolateA(LDRColorA c0, LDRColorA c1, int wa, int waprec, LDRColorA outt)
        {
            int[] aWeights = null;
            switch (waprec)
            {
            case 2: aWeights = Constants.g_aWeights2; Debug.Assert(wa < 4); break;

            case 3: aWeights = Constants.g_aWeights3; Debug.Assert(wa < 8); break;

            case 4: aWeights = Constants.g_aWeights4; Debug.Assert(wa < 16); break;

            default: Debug.Assert(false); outt.a = 0; return;
            }
            outt.a = (byte)(((uint)(c0.a) * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wa]) + (uint)(c1.a) * (uint)(aWeights[wa]) + Constants.BC67_WEIGHT_ROUND) >> Constants.BC67_WEIGHT_SHIFT);
        }
示例#4
0
        public static void InterpolateRGB(LDRColorA c0, LDRColorA c1, int wc, int wcprec, LDRColorA outt)
        {
            int[] aWeights = null;
            switch (wcprec)
            {
            case 2: aWeights = Constants.g_aWeights2; Debug.Assert(wc < 4); break;

            case 3: aWeights = Constants.g_aWeights3; Debug.Assert(wc < 8); break;

            case 4: aWeights = Constants.g_aWeights4; Debug.Assert(wc < 16); break;

            default: Debug.Assert(false); outt.r = outt.g = outt.b = 0; return;
            }
            outt.r = (byte)(((uint)(c0.r) * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wc]) + (uint)(c1.r) * (uint)(aWeights[wc]) + Constants.BC67_WEIGHT_ROUND) >> Constants.BC67_WEIGHT_SHIFT);
            outt.g = (byte)(((uint)(c0.g) * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wc]) + (uint)(c1.g) * (uint)(aWeights[wc]) + Constants.BC67_WEIGHT_ROUND) >> Constants.BC67_WEIGHT_SHIFT);
            outt.b = (byte)(((uint)(c0.b) * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wc]) + (uint)(c1.b) * (uint)(aWeights[wc]) + Constants.BC67_WEIGHT_ROUND) >> Constants.BC67_WEIGHT_SHIFT);
        }
示例#5
0
 public static void Interpolate(LDRColorA c0, LDRColorA c1, int wc, int wa, int wcprec, int waprec, LDRColorA outt)
 {
     InterpolateRGB(c0, c1, wc, wcprec, outt);
     InterpolateA(c0, c1, wa, waprec, outt);
 }