ZXing.PDF417.Internal.BoundingBox.addMissingRows C# (CSharp) Method

addMissingRows() public method

Adds the missing rows.
public addMissingRows ( int missingStartRows, int missingEndRows, bool isLeft ) : BoundingBox
missingStartRows int Missing start rows.
missingEndRows int Missing end rows.
isLeft bool If set to true is left.
return BoundingBox
      public BoundingBox addMissingRows(int missingStartRows, int missingEndRows, bool isLeft)
      {
         ResultPoint newTopLeft = TopLeft;
         ResultPoint newBottomLeft = BottomLeft;
         ResultPoint newTopRight = TopRight;
         ResultPoint newBottomRight = BottomRight;

         if (missingStartRows > 0)
         {
            ResultPoint top = isLeft ? TopLeft : TopRight;
            int newMinY = (int) top.Y - missingStartRows;
            if (newMinY < 0)
            {
               newMinY = 0;
            }
            ResultPoint newTop = new ResultPoint(top.X, newMinY);
            if (isLeft)
            {
               newTopLeft = newTop;
            }
            else
            {
               newTopRight = newTop;
            }
         }

         if (missingEndRows > 0)
         {
            ResultPoint bottom = isLeft ? BottomLeft : BottomRight;
            int newMaxY = (int) bottom.Y + missingEndRows;
            if (newMaxY >= image.Height)
            {
               newMaxY = image.Height - 1;
            }
            ResultPoint newBottom = new ResultPoint(bottom.X, newMaxY);
            if (isLeft)
            {
               newBottomLeft = newBottom;
            }
            else
            {
               newBottomRight = newBottom;
            }
         }

         calculateMinMaxValues();
         return new BoundingBox(image, newTopLeft, newBottomLeft, newTopRight, newBottomRight);
      }