private void pf_ImageWidthUpdate()
        {
            Rect rctArea = new Rect(new Point(0, 0), _rxivc.RenderSize);
            Rect rctImg  = _rxivc.GetImageBounds();

            double tmw   = rctArea.Width;
            double tiw   = rctImg.Width;
            double tssrw = tmw / tiw;

            _rxsbHori.ScrollSizeRatio = tssrw;
            if (tssrw < 1)
            {
                double tssw = tiw - tmw;
                double tprw = _rxsbHori.PositionRatio;
                double tix  = rctArea.Left - (tssw * tprw);

                _rxivc.MoveLeft(tix);
                _rxivc.BoundsDrawUpdate();
            }
            else
            {
                double tmx = RxGeom.GetLeftCenter(rctArea);

                _rxivc.MoveLeftCenter(tmx);
                _rxivc.BoundsDrawUpdate();
            }
        }
Example #2
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();
            }
        }
Example #4
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);
            });
        }
Example #5
0
        public void MoveLeft(double tv)
        {
            pf_UpdateMatrix(delegate(Matrix tmtr)
            {
                double ttx = tv - RxGeom.GetLeft(_rctBounds);
                double tty = 0;
                tmtr.Translate(ttx, tty);

                return(tmtr);
            });
        }
        private void pf__rxsiRotate_Callback()
        {
            //pf_Trace(_rxsiRotate.Value.ToString());

            double tag = _rxsiRotate.Value;

            _rxivc.SetRotateCenter(RxGeom.GetAngleToRadian(tag));
            _rxivc.BoundsDrawUpdate();

            pf_ImageHeightUpdate();
            pf_ImageWidthUpdate();
        }
Example #7
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);
            });
        }
Example #8
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);
            });
        }
Example #9
0
 public double GetTopCenter()
 {
     return(RxGeom.GetTopCenter(_rctBounds));
 }
Example #10
0
 public double GetBottom()
 {
     return(RxGeom.GetBottom(_rctBounds));
 }
Example #11
0
 public double GetRight()
 {
     return(RxGeom.GetRight(_rctBounds));
 }
Example #12
0
 public double GetTop()
 {
     return(RxGeom.GetTop(_rctBounds));
 }
Example #13
0
 public double GetHalfWidth()
 {
     return(RxGeom.GetHalfWidth(_rctBounds));
 }
Example #14
0
 private void pf_MeasureBounds()
 {
     _rctBounds = RxGeom.GetVisualBounds(this, _rctImage);
     _rctBounds.Inflate(10, 10);
     //RxGeom.RectBounds(ref _rctBounds);
 }