コード例 #1
0
        public static void InterpolateA(LdrColorA c0, LdrColorA c1, int wa, int waprec, LdrColorA outt)
        {
            DebugGuard.MustBeBetweenOrEqualTo(waprec, 2, 4, nameof(waprec));

            int[] aWeights;
            switch (waprec)
            {
            case 2:
            {
                aWeights = Constants.Weights2;
                Debug.Assert(wa < 4, "wc is expected to be smaller then 4");
                break;
            }

            case 3:
            {
                aWeights = Constants.Weights3;
                Debug.Assert(wa < 8, "wc is expected to be smaller then 8");
                break;
            }

            case 4:
            {
                aWeights = Constants.Weights4;
                Debug.Assert(wa < 16, "wc is expected to be smaller then 16");
                break;
            }

            default:
                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);
        }
コード例 #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 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);
 }