Wave-optics treatment of X-rays passing through straight and tapered capillaries