//~~~~~~~~~~ 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 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); }); }