Пример #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);
            });
        }
        private void pf_ImageHeightUpdate()
        {
            Rect rctArea = new Rect(new Point(0, 0), _rxivc.RenderSize);
            Rect rctImg  = _rxivc.GetImageBounds();

            double tmh   = rctArea.Height;
            double tih   = rctImg.Height;
            double tssrh = tmh / tih;

            _rxsbVert.ScrollSizeRatio = tssrh;
            if (tssrh < 1)
            {
                double tssh = tih - tmh;
                double tprh = _rxsbVert.PositionRatio;
                double tiy  = rctArea.Top - (tssh * tprh);

                _rxivc.MoveTop(tiy);
                _rxivc.BoundsDrawUpdate();
            }
            else
            {
                double tmy = RxGeom.GetTopCenter(rctArea);

                _rxivc.MoveTopCenter(tmy);
                _rxivc.BoundsDrawUpdate();
            }
        }
Пример #3
0
        public void MoveTopCenter(double tv)
        {
            pf_UpdateMatrix(delegate(Matrix tmtr)
            {
                double ttx = 0;
                double tty = tv - RxGeom.GetTopCenter(_rctBounds);
                tmtr.Translate(ttx, tty);

                return(tmtr);
            });
        }
Пример #4
0
        public void MoveCenter(double tmx, double tmy)
        {
            pf_UpdateMatrix(delegate(Matrix tmtr)
            {
                double tcx = RxGeom.GetLeftCenter(_rctBounds);
                double tcy = RxGeom.GetTopCenter(_rctBounds);
                double ttx = tmx - tcx;
                double tty = tmy - tcy;
                tmtr.Translate(ttx, tty);

                return(tmtr);
            });
        }
Пример #5
0
        public void SetRotateCenter(double trd)
        {
            pf_UpdateMatrix(delegate(Matrix tmtr)
            {
                double tyrd = RxGeom.GetRadian1(tmtr);
                double tnrd = RxGeom.CheckRadian(trd);
                if (tnrd != tyrd)
                {
                    double tcx = RxGeom.GetLeftCenter(_rctBounds);
                    double tcy = RxGeom.GetTopCenter(_rctBounds);
                    tmtr.Translate(-tcx, -tcy);

                    tmtr.Rotate(-RxGeom.GetRadianToAngle(tyrd));
                    tmtr.Rotate(RxGeom.GetRadianToAngle(tnrd));
                    tmtr.Translate(tcx, tcy);
                }

                return(tmtr);
            });
        }
Пример #6
0
 public double GetTopCenter()
 {
     return(RxGeom.GetTopCenter(_rctBounds));
 }