コード例 #1
0
 public IntColor SignExtend(LdrColorA Prec)
 {
     r = SIGN_EXTEND(r, Prec.r);
     g = SIGN_EXTEND(g, Prec.g);
     b = SIGN_EXTEND(b, Prec.b);
     return(this);
 }
コード例 #2
0
        public static void TransformInverseUnsigned(IntEndPntPair[] aEndPts, LdrColorA Prec)
        {
            var 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;
        }
コード例 #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)(c0.a * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wa]) + 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)(c0.r * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wc]) + c1.r * (uint)aWeights[wc] + Constants.BC67_WEIGHT_ROUND >> Constants.BC67_WEIGHT_SHIFT);
            outt.g = (byte)(c0.g * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wc]) + c1.g * (uint)aWeights[wc] + Constants.BC67_WEIGHT_ROUND >> Constants.BC67_WEIGHT_SHIFT);
            outt.b = (byte)(c0.b * (uint)(Constants.BC67_WEIGHT_MAX - aWeights[wc]) + 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);
 }