private Rect pf_MeasureBounds() { Rect trct = RxGeom.GetVisualBounds(this, _rctImage); trct.Inflate(10, 10); return(trct); }
//~~~~~~~~~~ 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); }); }
//~~~~~~~~~~ public void MoveCenter(double tcx, double tcy) { pf_UpdateMatrix(delegate(Matrix tmtr) { double ttx = tcx - RxGeom.GetLeftCenter(_rctBounds); double tty = tcy - RxGeom.GetTopCenter(_rctBounds); tmtr.Translate(ttx, tty); return(tmtr); }); }
public void MoveTopCenter(double tv) { pf_UpdateMatrix(delegate(Matrix tmtr) { double ttx = 0; double tty = tv - RxGeom.GetTop(_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); }); }
/// <summary> /// 한바퀴 돌아간 라디안 보정 /// </summary> /// <param name="trd"></param> /// <returns></returns> public static double CheckRadian(double trd) { if (trd < 0) { trd = RxGeom.FullRadianHalf + trd; } else if (trd >= RxGeom.FullRadianHalf) { trd = trd - RxGeom.FullRadian; } return(RxGeom.DoubleRound(trd)); }
protected override void OnMouseWheel(MouseWheelEventArgs tea) { base.OnMouseWheel(tea); if (Keyboard.IsKeyDown(Key.LeftAlt)) { if (tea.Delta < 0) { _sa -= 0.1; if (_sa < 0.1) { _sa = 0.1; } _rxiv.SetScaleCenter(_sa, _sa); _rxibv.DrawUpdate(_rxiv.GetBounds()); } else if (tea.Delta > 0) { _sa += 0.1; _rxiv.SetScaleCenter(_sa, _sa); _rxibv.DrawUpdate(_rxiv.GetBounds()); } } else { if (tea.Delta < 0) { _ag -= 5; if (_ag < 0) { _ag = 0; } _rxiv.SetRotateCenter(RxGeom.GetAngleToRadian(_ag)); _rxibv.DrawUpdate(_rxiv.GetBounds()); } else if (tea.Delta > 0) { _ag += 5; if (_ag > 360) { _ag = 360; } _rxiv.SetRotateCenter(RxGeom.GetAngleToRadian(_ag)); _rxibv.DrawUpdate(_rxiv.GetBounds()); } RxLog.Trace(_ag.ToString()); } }
//~~~~~~~~~~ public void SetRotateCenter(double trd) { pf_UpdateMatrix(delegate(Matrix tmtr) { double tyrd = RxGeom.GetRadian1(tmtr); double tnrd = RxGeom.CheckRadian(trd); //Debug.WriteLine(string.Format("tyrd: {0}, tnrd: {1} ", tyrd, tnrd)); 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); }); }
private void pf__btn1_Click(object tsd, RoutedEventArgs tea) { _ag += 15; _rxiv.SetRotateCenter(RxGeom.GetAngleToRadian(_ag)); }