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(); } }
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(); } }
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); }); }
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(); }
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); }); }
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); }); }
public double GetTopCenter() { return(RxGeom.GetTopCenter(_rctBounds)); }
public double GetBottom() { return(RxGeom.GetBottom(_rctBounds)); }
public double GetRight() { return(RxGeom.GetRight(_rctBounds)); }
public double GetTop() { return(RxGeom.GetTop(_rctBounds)); }
public double GetHalfWidth() { return(RxGeom.GetHalfWidth(_rctBounds)); }
private void pf_MeasureBounds() { _rctBounds = RxGeom.GetVisualBounds(this, _rctImage); _rctBounds.Inflate(10, 10); //RxGeom.RectBounds(ref _rctBounds); }