예제 #1
0
        // --------------------------------------------------------------------------------
        // Name        : AddPosition
        // Description : Add new anchor point
        // --------------------------------------------------------------------------------
        public void addPosition(PackerPos p)
        {
            // Try to insert anchor as close as possible to the top left corner
            // So it will be tried first
            bool bFound = false;
            int  pos    = 0;

            foreach (PackerPos it in vPositions)
            {
                if (p.x + p.y < it.x + it.y)
                {
                    bFound = true;
                    break;
                }
                pos++;
            }
            if (bFound)
            {
                vPositions.Insert(pos, p);
            }
            else
            {
                vPositions.Add(p);
            }
        }
예제 #2
0
 public bool containsPoint(PackerPos p)
 {
     return (p.x >= x && p.y >= y &&
         p.x < (x + w) && p.y < (y + h));
 }
예제 #3
0
 public bool isEqual(PackerPos obj)
 {
     return x == obj.x && y == obj.y;
 }
예제 #4
0
 // --------------------------------------------------------------------------------
 // Name        : AddPosition
 // Description : Add new anchor point
 // --------------------------------------------------------------------------------
 public void addPosition(PackerPos p)
 {
     // Try to insert anchor as close as possible to the top left corner
     // So it will be tried first
     bool bFound = false;
     int pos = 0;
     foreach (PackerPos it in vPositions)
     {
         if (p.x + p.y < it.x + it.y)
         {
             bFound = true;
             break;
         }
         pos++;
     }
     if (bFound)
         vPositions.Insert(pos, p);
     else
         vPositions.Add(p);
 }
예제 #5
0
 public bool containsPoint(PackerPos p)
 {
     return(p.x >= x && p.y >= y &&
            p.x < (x + w) && p.y < (y + h));
 }
예제 #6
0
 public bool isEqual(PackerPos obj)
 {
     return(x == obj.x && y == obj.y);
 }