예제 #1
0
 public override bool Equals(object obj)
 {
     if (obj is SizeR)
     {
         SizeR sz = (SizeR)obj;
         return(Width == sz.Width && Height == sz.Height);
     }
     return(false);
 }
예제 #2
0
        // translates the points by the given delta amounts
        public static ArrayList TranslateBy(ArrayList points, SizeR sz)
        {
            ArrayList newPoints = new ArrayList(points.Count);

            for (int i = 0; i < points.Count; i++)
            {
                PointR p = (PointR)points[i];
                p.X += sz.Width;
                p.Y += sz.Height;
                newPoints.Add(p);
            }
            return(newPoints);
        }
예제 #3
0
        // scales by the percentages contained in the 'sz' parameter. values of 1.0 would result in the
        // identity scale (that is, no change).
        public static ArrayList ScaleBy(ArrayList points, SizeR sz)
        {
            ArrayList  newPoints = new ArrayList(points.Count);
            RectangleR r         = FindBox(points);

            for (int i = 0; i < points.Count; i++)
            {
                PointR p = (PointR)points[i];
                p.X *= sz.Width;
                p.Y *= sz.Height;
                newPoints.Add(p);
            }
            return(newPoints);
        }
예제 #4
0
        // scales the points so that they form the size given. does not restore the
        // origin of the box.
        public static ArrayList ScaleTo(ArrayList points, SizeR sz)
        {
            ArrayList  newPoints = new ArrayList(points.Count);
            RectangleR r         = FindBox(points);

            for (int i = 0; i < points.Count; i++)
            {
                PointR p = (PointR)points[i];
                if (r.Width != 0d)
                {
                    p.X *= (sz.Width / r.Width);
                }
                if (r.Height != 0d)
                {
                    p.Y *= (sz.Height / r.Height);
                }
                newPoints.Add(p);
            }
            return(newPoints);
        }
예제 #5
0
 // translates the points by the given delta amounts
 public static ArrayList TranslateBy(ArrayList points, SizeR sz)
 {
     ArrayList newPoints = new ArrayList(points.Count);
     for (int i = 0; i < points.Count; i++)
     {
         PointR p = (PointR) points[i];
         p.X += sz.Width;
         p.Y += sz.Height;
         newPoints.Add(p);
     }
     return newPoints;
 }
예제 #6
0
 // scales the points so that they form the size given. does not restore the
 // origin of the box.
 public static ArrayList ScaleTo(ArrayList points, SizeR sz)
 {
     ArrayList newPoints = new ArrayList(points.Count);
     RectangleR r = FindBox(points);
     for (int i = 0; i < points.Count; i++)
     {
         PointR p = (PointR) points[i];
         if (r.Width != 0d)
             p.X *= (sz.Width / r.Width);
         if (r.Height != 0d)
             p.Y *= (sz.Height / r.Height);
         newPoints.Add(p);
     }
     return newPoints;
 }
예제 #7
0
 // scales by the percentages contained in the 'sz' parameter. values of 1.0 would result in the
 // identity scale (that is, no change).
 public static ArrayList ScaleBy(ArrayList points, SizeR sz)
 {
     ArrayList newPoints = new ArrayList(points.Count);
     RectangleR r = FindBox(points);
     for (int i = 0; i < points.Count; i++)
     {
         PointR p = (PointR) points[i];
         p.X *= sz.Width;
         p.Y *= sz.Height;
         newPoints.Add(p);
     }
     return newPoints;
 }
예제 #8
0
 // copy constructor
 public SizeR(SizeR sz)
 {
     _cx = sz.Width;
     _cy = sz.Height;
 }
예제 #9
0
 // copy constructor
 public SizeR(SizeR sz)
 {
     _cx = sz.Width;
     _cy = sz.Height;
 }