private Affine(AffinePlan[] creationPlans)
        {
            //-----------------------
            //start with identity matrix
            _elems     = AffineMat.Iden;//copy
            isIdenHint = true;
            if (creationPlans == null)
            {
                return;
            }

            //-----------------------
            int j = creationPlans.Length;

            for (int i = 0; i < j; ++i)
            {
                AffinePlan plan = creationPlans[i];
                switch (plan.cmd)
                {
                case AffineMatrixCommand.None:
                    break;

                case AffineMatrixCommand.Rotate:

                    isIdenHint = false;
                    _elems.Rotate(plan.x);

                    break;

                case AffineMatrixCommand.Scale:

                    isIdenHint = false;
                    _elems.Scale(plan.x, plan.y);

                    break;

                case AffineMatrixCommand.Translate:

                    isIdenHint = false;
                    _elems.Translate(plan.x, plan.y);

                    break;

                case AffineMatrixCommand.Skew:
                    isIdenHint = false;
                    _elems.Skew(plan.x, plan.y);
                    break;

                case AffineMatrixCommand.Invert:
                    isIdenHint = false;
                    _elems.Invert();
                    break;

                default:
                    throw new NotSupportedException();
                }
            }
        }
Exemple #2
0
        private Affine(Affine copyFrom, AffinePlan creationPlan)
        {
            _elems = copyFrom._elems;
            //-----------------------
            switch (creationPlan.cmd)
            {
            default:
            {
                throw new NotSupportedException();
            }

            case AffineMatrixCommand.None:
                _isIdenHint = copyFrom._isIdenHint;
                break;

            case AffineMatrixCommand.Rotate:
                _isIdenHint = false;
                _elems.Rotate(creationPlan.x);

                break;

            case AffineMatrixCommand.Scale:
                _isIdenHint = false;
                _elems.Scale(creationPlan.x, creationPlan.y);

                break;

            case AffineMatrixCommand.Skew:
                _isIdenHint = false;
                _elems.Skew(creationPlan.x, creationPlan.y);

                break;

            case AffineMatrixCommand.Translate:
                _isIdenHint = false;
                _elems.Translate(creationPlan.x, creationPlan.y);

                break;

            case AffineMatrixCommand.Invert:
                _isIdenHint = false;
                _elems.Invert();
                break;
            }
        }
Exemple #3
0
        void BuildAff(ref AffinePlan plan)
        {
            switch (plan.cmd)
            {
            case AffineMatrixCommand.None:
                break;

            case AffineMatrixCommand.Rotate:

                _isIdenHint = false;
                _elems.Rotate(plan.x);
                break;

            case AffineMatrixCommand.Scale:
                _isIdenHint = false;
                _elems.Scale(plan.x, plan.y);
                break;

            case AffineMatrixCommand.Translate:
                _isIdenHint = false;
                _elems.Translate(plan.x, plan.y);
                break;

            case AffineMatrixCommand.Skew:
                _isIdenHint = false;
                _elems.Skew(plan.x, plan.y);
                break;

            case AffineMatrixCommand.Invert:
                _isIdenHint = false;
                _elems.Invert();
                break;

            default:
                throw new NotSupportedException();
            }
        }