public MoveRectangleModel() { var imageSourceSize = MyImage.ToRoixIntSize(); var initialRect = new RoixIntRect(1, 2, 2, 2).ToRoixBorder(imageSourceSize); Rect = new ReactivePropertySlim <RoixBorderIntRect>(initialValue: initialRect); //Rect.Subscribe(x => Debug.WriteLine($"Model Rect: {x}")); }
public void FromRoix(int x, int y, int width, int height) { var rr1 = new RoixRect(x, y, width, height); RoixIntRect rir1 = rr1.ToRoixInt(); rir1.X.Is((int)Math.Round(rr1.X)); rir1.Y.Is((int)Math.Round(rr1.Y)); rir1.Width.Is((int)Math.Round(rr1.Width)); rir1.Height.Is((int)Math.Round(rr1.Height)); }
public void ToRoix(int x, int y, int width, int height) { var rir1 = new RoixIntRect(new RoixIntPoint(x, y), new RoixIntSize(width, height)); RoixRect rr1 = (RoixRect)rir1; rr1.X.Is(rir1.X); rr1.Y.Is(rir1.Y); rr1.Width.Is(rir1.Width); rr1.Height.Is(rir1.Height); }
public void Equal() { int x = 1, y = 2, width = 3, height = 4; var rect1 = new RoixIntRect(new RoixIntPoint(x, y), new RoixIntSize(width, height)); var rect2 = new RoixIntRect(new RoixIntPoint(x, y), new RoixIntSize(width, height)); rect1.Equals(rect2).IsTrue(); (rect1 == rect2).IsTrue(); (rect1 != rect2).IsFalse(); var obj2 = (object)rect2; rect1.Equals(obj2).IsTrue(); }
public void Deconstruct() { var rect = new RoixIntRect(new RoixIntPoint(1, 2), new RoixIntSize(3, 4)); //var (x, y, w, h) = rect; //x.Is(rect.Location.X); //y.Is(rect.Location.Y); //w.Is(rect.Size.Width); //h.Is(rect.Size.Height); var(p, s) = rect; p.Is(rect.Location); s.Is(rect.Size); }
public void Ctor(int x, int y, int width, int height) { var point = new RoixIntPoint(x, y); var size = new RoixIntSize(width, height); var rect1 = new RoixIntRect(point, size); rect1.Location.X.Is(point.X); rect1.Location.Y.Is(point.Y); rect1.Size.Width.Is(size.Width); rect1.Size.Height.Is(size.Height); var rect2 = new RoixIntRect(new RoixIntPoint(x, y), new RoixIntSize(width, height)); rect2.Location.X.Is(point.X); rect2.Location.Y.Is(point.Y); rect2.Size.Width.Is(size.Width); rect2.Size.Height.Is(size.Height); }
public void Properties(double x, double y, double width, double height) { var point = new RoixPoint(x, y); var size = new RoixSize(width, height); var r = new RoixIntRect(point.ToRoixInt(), size.ToRoixInt()); r.X.Is(r.Location.X); r.Y.Is(r.Location.Y); r.Width.Is(r.Size.Width); r.Height.Is(r.Size.Height); r.Left.Is(r.X); r.Right.Is(r.X + r.Width); r.Top.Is(r.Y); r.Bottom.Is(r.Y + r.Height); r.TopLeft.Is(new(r.Left, r.Top)); r.TopRight.Is(new(r.Right, r.Top)); r.BottomLeft.Is(new(r.Left, r.Bottom)); r.BottomRight.Is(new(r.Right, r.Bottom)); }