Example #1
0
        public void SetScaleCenter(double tsx, double tsy)
        {
            if (tsx < 0.1)
            {
                return;
            }
            if (tsy < 0.1)
            {
                return;
            }

            pf_UpdateMatrix(delegate(Matrix tmtr)
            {
                double tysx = RxGeom.GetScaleX(tmtr);
                double tysy = RxGeom.GetScaleY(tmtr);

                double tnsx = RxGeom.DoubleRound(tsx);
                double tnsy = RxGeom.DoubleRound(tsy);

                if ((tysx != tnsx) && (tysy != tnsy))
                {
                    double tcx = RxGeom.GetLeftCenter(_rctBounds);
                    double tcy = RxGeom.GetTopCenter(_rctBounds);
                    tmtr.Translate(-tcx, -tcy);

                    double tbsx = 1 / tysx;
                    double tbsy = 1 / tysy;
                    tmtr.Scale(tbsx, tbsy);
                    tmtr.Scale(tnsx, tnsy);
                    tmtr.Translate(tcx, tcy);
                }

                return(tmtr);
            });
        }