12345678910111213141516171819202122232425262728293031323334 |
- namespace AIDiagnosisDemo.Infrastucture
- {
- public class MyTransform
- {
- public double Scale { get; set; }
- public double OffsetX { get; set; }
- public double OffsetY { get; set; }
- public MyTransform(double scale, double offsetX, double offsetY)
- {
- Scale = scale;
- OffsetX = offsetX;
- OffsetY = offsetY;
- }
- public System.Windows.Point Transform(System.Windows.Point point)
- {
- double x = OffsetX + Scale * point.X;
- double y = OffsetY + Scale * point.Y;
- return new System.Windows.Point(x, y);
- }
- public System.Windows.Rect Transform(System.Windows.Rect rect)
- {
- double left = OffsetX + Scale * rect.Left;
- double top = OffsetY + Scale * rect.Top;
- double width = Scale * rect.Width;
- double height = Scale * rect.Height;
- return new System.Windows.Rect(left, top, width, height);
- }
- }
- }
|