Modal formulation for diffraction by absorbing photonic crystal slabs.