Exemple #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);
            }
        }
Exemple #2
0
 public bool containsPoint(PackerPos p)
 {
     return (p.x >= x && p.y >= y &&
         p.x < (x + w) && p.y < (y + h));
 }
Exemple #3
0
 public bool isEqual(PackerPos obj)
 {
     return x == obj.x && y == obj.y;
 }
Exemple #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);
 }
Exemple #5
0
 public bool containsPoint(PackerPos p)
 {
     return(p.x >= x && p.y >= y &&
            p.x < (x + w) && p.y < (y + h));
 }
Exemple #6
0
 public bool isEqual(PackerPos obj)
 {
     return(x == obj.x && y == obj.y);
 }