code: public Rectangular transformRect(Rectangular rect)
      {
          if (transform != null)
          {
              Rectangle src = new Rectangle(rect.getX1(), rect.getY1(), rect.getWidth(), rect.getHeight());
              Shape dest = transform.createTransformedShape(src);
              Rectangle destr;
              if (dest instanceof Rectangle)
                  destr = (Rectangle) dest;
              else
                  destr = dest.getBounds();
              return new Rectangular(destr);
          }
          else
              return rect;
      }
docs: Transforms a rectangle to other rectangle using the given transformation.
  @param rect the source rectangle
  @return the bounding box of the transformed rectangle.